Skip to content

Instantly share code, notes, and snippets.

@bacongravy
Last active June 11, 2020 15:49
Show Gist options
  • Save bacongravy/41dc1e1c9a7e038c637691fd165530fb to your computer and use it in GitHub Desktop.
Save bacongravy/41dc1e1c9a7e038c637691fd165530fb to your computer and use it in GitHub Desktop.
<html>
<head>
<title>
Hello API Example
</title>
<script lang="javascript">
fetch("/api/hello")
.then((res) => res.text())
.then((text) => {
document.getElementById("api-response").innerHTML = text;
});
</script>
</head>
<body>
<p>Response from /api/hello: <span id="api-response"></span></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment