mirror of
https://github.com/documenso/documenso
synced 2026-04-21 21:37:18 +00:00
### Summary - Add Cache-Control headers to all route responses (1h s-maxage, 2h stale-while-revalidate) - Append current month to chart data so graphs stay up-to-date (cumulative carries forward, else zero) - Remove `.limit(12)` from growth queries for full history - Pass isCumulative flag through addZeroMonth - Deduplicate TransformedData type, remove transformRepoStats
28 lines
667 B
TypeScript
28 lines
667 B
TypeScript
import cors from '@/lib/cors';
|
|
|
|
export async function GET(request: Request) {
|
|
const res = await fetch(
|
|
'https://api.github.com/search/issues?q=repo:documenso/documenso+type:issue+state:open&page=0&per_page=1',
|
|
);
|
|
const { total_count } = await res.json();
|
|
|
|
return cors(
|
|
request,
|
|
new Response(JSON.stringify({ data: total_count }), {
|
|
status: 200,
|
|
headers: {
|
|
'content-type': 'application/json',
|
|
'Cache-Control': 'public, s-maxage=3600, stale-while-revalidate=7200',
|
|
},
|
|
}),
|
|
);
|
|
}
|
|
|
|
export function OPTIONS(request: Request) {
|
|
return cors(
|
|
request,
|
|
new Response(null, {
|
|
status: 204,
|
|
}),
|
|
);
|
|
}
|