1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2024-11-28 10:22:24 +01:00
rolens/website/data/github.js

14 lines
380 B
JavaScript
Raw Normal View History

2023-06-01 22:06:51 +02:00
const { default: fetch } = require("node-fetch")
module.exports = async function() {
try {
2023-06-23 18:42:03 +02:00
const res = await fetch('https://api.github.com/repos/garraflavatra/rolens');
2023-06-01 22:06:51 +02:00
const json = await res.json();
return { stars: json.stargazers_count || 0 };
}
catch (error) {
console.error('Error: could not fetch GitHub stars:', error);
2023-06-01 22:06:51 +02:00
return { stars: 0 };
}
}