Skip to content

Instantly share code, notes, and snippets.

@johnpolacek
Created February 19, 2022 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpolacek/b6d85286a96b4ff14efc07cf040a66d8 to your computer and use it in GitHub Desktop.
Save johnpolacek/b6d85286a96b4ff14efc07cf040a66d8 to your computer and use it in GitHub Desktop.
Fetch Example
fetch('https://example.com').then(response => {
if (!response.ok) {
throw Error(response.statusText);
}
return response.json();
})
.then(data => {
res.status(200).json({ data })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment