peppa/apps/web/app/api/health/route.ts
Асель c739e877f5 PEP-114: a page opened before the site was updated asks to be reloaded
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 15:58:52 +05:00

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" } });
}