Skip to content

Instantly share code, notes, and snippets.

@elijahjcobb
Last active July 22, 2022 05:59
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 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