Files
sign/apps/openpage-api/app/community/total-issues/route.ts
Ephraim Atta-Duncan 25d4f1e101 fix: data return format
2024-10-24 11:05:54 +00:00

28 lines
636 B
TypeScript

import cors from '@/lib/cors';
import { transformRepoStats } from '@/lib/transform-repo-stats';
export async function GET(request: Request) {
const res = await fetch('https://stargrazer-live.onrender.com/api/stats');
const data = await res.json();
const transformedData = transformRepoStats(data, 'openIssues');
return cors(
request,
new Response(JSON.stringify(transformedData), {
status: 200,
headers: {
'content-type': 'application/json',
},
}),
);
}
export function OPTIONS(request: Request) {
return cors(
request,
new Response(null, {
status: 204,
}),
);
}