Skip to content

Instantly share code, notes, and snippets.

@elijahjcobb
Last active July 22, 2022 05:59
Show Gist options
  • Save elijahjcobb/4d23b7dddf2901b7a0be0abcc8683da3 to your computer and use it in GitHub Desktop.
Save elijahjcobb/4d23b7dddf2901b7a0be0abcc8683da3 to your computer and use it in GitHub Desktop.
Fetch a single gist from GitHub's REST API
const id = "<the-gist-id>";
fetch(`https://api.github.com/gists/${id}`)
.then(res => res.json())
.then(gist => {
const {createdAt, description} = gist;
console.log(`The ${description} gist was created at ${createdAt}!`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment