Add /api/health and /api/tasks route handlers

This commit is contained in:
Grok Bot
2026-11-26 09:10:37 +00:00
parent 8be52a3647
commit a85f6d95d8
3 changed files with 59 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { NextResponse } from 'next/server';
import { dbHealth } from '@/lib/db';
import { buildInfo } from '@/lib/build-info';
export const dynamic = 'force-dynamic';
export async function GET() {
const database = await dbHealth();
const ok = database.status === 'up';
return NextResponse.json(
{
status: ok ? 'ok' : 'degraded',
version: buildInfo.version,
commit: buildInfo.commit,
sourceHash: buildInfo.sourceHash,
builtAt: buildInfo.builtAt,
uptimeSeconds: Math.round(process.uptime()),
database,
},
{ status: ok ? 200 : 503 }
);
}