Skip to content

Instantly share code, notes, and snippets.

@FergusInLondon
Created April 30, 2020 15:17
Show Gist options
  • Save FergusInLondon/ae83c10412f276f294ae933a06726f89 to your computer and use it in GitHub Desktop.
Save FergusInLondon/ae83c10412f276f294ae933a06726f89 to your computer and use it in GitHub Desktop.
Get github gists for static site generation
async function getGithubGists(username) {
const gists = await require('axios').get(
`https://api.github.com/users/${username}/gists`
)
return gists.data.map(({html_url, description, created_at, files}) => {
return {
url: html_url,
files: Object.keys(files),
description, created_at
}
})
}
getGithubGists('FergusInLondon').then(console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment