14 lines
351 B
TypeScript
14 lines
351 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { checkDbConnection } from "@/lib/db";
|
|
|
|
export async function GET() {
|
|
const dbHealthy = await checkDbConnection();
|
|
|
|
return NextResponse.json(
|
|
{
|
|
status: dbHealthy ? "ok" : "degraded",
|
|
db: dbHealthy ? "connected" : "unavailable",
|
|
},
|
|
{ status: dbHealthy ? 200 : 503 },
|
|
);
|
|
} |