Last active
December 1, 2020 09:02
-
-
Save dmdboi/816a69de41976c1ae52d109883e79897 to your computer and use it in GitHub Desktop.
A Netlify function to return your public GitHub repositories.
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
const axios = require("axios"); | |
exports.handler = async event => { | |
try { | |
let username = "" // Your Github Username | |
let repos = await axios({ | |
method: "GET", | |
url: `https://api.github.com/users/${username}/repos` | |
}).then(res => { | |
return res.data; | |
}); | |
return { | |
statusCode: 200, | |
body: JSON.stringify(repos) | |
}; | |
} catch (e) { | |
return { | |
statusCode: 404, | |
body: JSON.stringify(e) | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment