16 lines
655 B
TypeScript
16 lines
655 B
TypeScript
import { healthReport } from "@peppa/core";
|
|
import { bootId } from "@/lib/boot";
|
|
import { db } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/** Public health check (PEP-20): DB, version, service heartbeats. 503 if the DB is down. */
|
|
export async function GET() {
|
|
const r = await healthReport(db, {
|
|
version: process.env.NEXT_PUBLIC_PEPPA_VERSION,
|
|
commit: process.env.NEXT_PUBLIC_PEPPA_COMMIT || null,
|
|
});
|
|
// PEP-114: `boot` changes when the web process restarts — open pages compare it with their own.
|
|
return Response.json({ ...r, boot: bootId() }, { status: r.ok ? 200 : 503, headers: { "Cache-Control": "no-store" } });
|
|
}
|