Created
April 30, 2020 15:17
-
-
Save FergusInLondon/ae83c10412f276f294ae933a06726f89 to your computer and use it in GitHub Desktop.
Get github gists for static site generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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