Created
August 18, 2022 13:48
-
-
Save TangoPJ/ce4f847b6a4850eeb7528ade2e5d5dca to your computer and use it in GitHub Desktop.
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
import axios from "axios"; | |
const getInfoFromGit = async (urls) => { | |
const response = []; | |
for (const url of urls) { | |
try { | |
const { | |
data: { stargazers_count, forks, name, html_url }, | |
} = await axios.get(`https://api.github.com/repos/${url}`); | |
response.push({ | |
stars: stargazers_count, | |
forks: forks, | |
name, | |
url: html_url, | |
}); | |
} catch (error) { | |
console.log(error); | |
throw new Error(error); | |
} | |
} | |
return response; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment