Skip to content

Instantly share code, notes, and snippets.

@bennett39
Created February 17, 2021 12:10
Show Gist options
  • Save bennett39/efa253d1208c38e51741f0ab60b4d451 to your computer and use it in GitHub Desktop.
Save bennett39/efa253d1208c38e51741f0ab60b4d451 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<script>
async function fetchSandwich() {
let apiUrl = 'https://***.execute-api.us-east-2.amazonaws.com/default/lambda_tutorial'
let response = await fetch(apiUrl);
let body = await response.json();
document.getElementById('sandwich-result').innerHTML = body.sandwich;
}
</script>
</head>
<body>
<h1>Sandwich Generator</h1>
<p>Click the button, get a sandwich!</p>
<input type="button" value="Make a sandwich!" onclick="fetchSandwich()">
<p id="sandwich-result"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment