mirror of
https://github.com/garraflavatra/rolens.git
synced 2024-11-24 18:26:56 +01:00
14 lines
380 B
JavaScript
14 lines
380 B
JavaScript
const { default: fetch } = require("node-fetch")
|
|
|
|
module.exports = async function() {
|
|
try {
|
|
const res = await fetch('https://api.github.com/repos/garraflavatra/rolens');
|
|
const json = await res.json();
|
|
return { stars: json.stargazers_count || 0 };
|
|
}
|
|
catch (error) {
|
|
console.error('Error: could not fetch GitHub stars:', error);
|
|
return { stars: 0 };
|
|
}
|
|
}
|