githubinator
Version:
Fetching Data from https://github.com
18 lines (12 loc) • 406 B
JavaScript
const fetch = require("node-fetch");
async function getUser(username) {
if (!username) {
throw new Error('Please, give Github Username');
}
let res = await fetch(`https://api.github.com/users/${username}/followers`).then(res => res.json());
if (res.message) {
throw new Error('Invalid Username');
}
return res;
};
module.exports = getUser;