Files

18 lines
553 B
TypeScript

import { sql } from 'drizzle-orm'
import { db, serverErrors, withRequest } from '@/shared/api'
// 200 when Postgres answers; the platform probes this path (health_check_path).
export const dynamic = 'force-dynamic'
export async function GET(request: Request) {
return withRequest(request, async () => {
try {
await db().execute(sql`select 1`)
return Response.json({ status: 'ok' })
} catch (error) {
serverErrors().captureException(error)
return Response.json({ status: 'unavailable' }, { status: 503 })
}
})
}