diff --git a/app/api/health/route.ts b/app/api/health/route.ts new file mode 100644 index 0000000..4370ea9 --- /dev/null +++ b/app/api/health/route.ts @@ -0,0 +1,5 @@ +// Liveness probe. Reads no repo data and touches no cache, so a failed check +// means the Worker is down, not that a card render failed. +export function GET() { + return Response.json({ ok: true }, { headers: { "Cache-Control": "no-store" } }); +} diff --git a/tests/health-route.test.ts b/tests/health-route.test.ts new file mode 100644 index 0000000..23c74e5 --- /dev/null +++ b/tests/health-route.test.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from "vitest"; +import { GET } from "../app/api/health/route"; + +describe("/health", () => { + it("returns a small stable JSON status", async () => { + const res = GET(); + expect(res.status).toBe(200); + expect(res.headers.get("content-type")).toContain("application/json"); + expect(res.headers.get("cache-control")).toBe("no-store"); + expect(await res.json()).toEqual({ ok: true }); + }); +});