import { NextResponse } from 'next/server';
// Route handlers are dynamic by default in Next.js 15+.
// force-dynamic is defensive so a future opt-in to caching cannot freeze a stale response.
export const dynamic = 'force-dynamic';
export async function GET() {
const checks = {
db: await pingDatabase(),
redis: await pingRedis(),
};
const healthy = Object.values(checks).every(Boolean);
return NextResponse.json(
{ status: healthy ? 'ok' : 'degraded', checks, ts: Date.now() },
{ status: healthy ? 200 : 503 }
);
}