feat: stats page

This commit is contained in:
Lewis Wynne 2026-01-23 18:35:57 +00:00
parent 4095158e7b
commit 0fa86f4a81
3 changed files with 113 additions and 0 deletions

View file

@ -0,0 +1,17 @@
import type { APIRoute } from 'astro';
import { getApprovedEntries } from '../lib/db';
export const prerender = true;
export const GET: APIRoute = async () => {
let count = 0;
try {
const entries = await getApprovedEntries();
count = entries.length;
} catch {
// DB not available
}
return new Response(JSON.stringify({ count }), {
headers: { 'Content-Type': 'application/json' },
});
};