mcfly/routes/api/stars/[org]/[repo].ts
2023-10-07 20:06:23 +02:00

21 lines
371 B
TypeScript

export default eventHandler((event) => {
const { org, repo } = event.context.params;
return getStars(org, repo);
});
type Project = {
org: string;
repo: string;
stars: string;
};
const getStars = async (org: string, repo: string): Promise<Project> => {
const stars = await cachedGHStars(`${org}/${repo}`);
return {
org,
repo,
stars,
};
};