SPB Git
486 B · 7 lines typescript
1import { sqlPublic } from "@/db";2export const dynamic = "force-dynamic";3export async function GET() {4  try { const [r] = await sqlPublic`SELECT count(*)::int AS n FROM public_papers WHERE status = 'published'`; return Response.json({ ok: true, papers: r.n, time: new Date().toISOString() }, { headers: { "Cache-Control": "no-store" } }); }5  catch (e) { return Response.json({ ok: false, error: (e as Error).message }, { status: 503, headers: { "Cache-Control": "no-store" } }); }6}7
Files · main
Menu

Theme