profileShare

rasmusjy / roundtable

Read-only snapshot

No repository description.

main default branch 181 files Expires Sep 13, 2026, 9:06 AM

Commit

add health check endpoint

commit ced8632

1 changed file with +19 and −0

added src/app/api/health/route.ts +19 −0
@@ -0,0 +1,19 @@
1 +import { NextResponse } from 'next/server';
2 +import { prisma } from '@/db/client';
3 +
4 +export const runtime = 'nodejs';
5 +export const dynamic = 'force-dynamic';
6 +
7 +/**
8 + * Liveness/readiness probe. Pings the database so a load balancer or the deploy
9 + * workflow can tell "process is up" from "process is up and can serve".
10 + */
11 +export async function GET() {
12 + const startedAt = Date.now();
13 + try {
14 + await prisma.$queryRaw`SELECT 1`;
15 + return NextResponse.json({ status: 'ok', db: 'up', latencyMs: Date.now() - startedAt });
16 + } catch {
17 + return NextResponse.json({ status: 'degraded', db: 'down' }, { status: 503 });
18 + }
19 +}