Files
sign/apps/openpage-api/app/route.ts

36 lines
755 B
TypeScript
Raw Normal View History

2024-10-23 22:03:10 +00:00
import type { NextRequest } from 'next/server';
import cors from '@/lib/cors';
2024-10-23 17:33:16 +00:00
2024-10-24 10:32:18 +00:00
const paths = [
{ path: 'github', description: 'GitHub Data' },
{ path: 'community', description: 'Community Data' },
{ path: 'growth', description: 'Growth Data' },
2024-10-24 10:32:18 +00:00
];
2024-10-23 17:33:16 +00:00
export function GET(request: NextRequest) {
const url = request.nextUrl.toString();
const apis = paths.map(({ path, description }) => {
return { path: url + path, description };
});
2024-10-23 22:03:10 +00:00
return cors(
request,
new Response(JSON.stringify(apis), {
status: 200,
headers: {
'content-type': 'application/json',
},
}),
);
}
export function OPTIONS(request: Request) {
return cors(
request,
new Response(null, {
status: 204,
}),
);
2024-10-23 17:33:16 +00:00
}