Files
biblical-guide.com/app/api/health/route.ts

32 lines
612 B
TypeScript

import { NextResponse } from 'next/server'
import { prisma } from '@/lib/db'
export const runtime = 'nodejs'
export async function GET() {
try {
// Check database connection
await prisma.$queryRaw`SELECT 1`
const checks = {
database: true,
timestamp: new Date().toISOString()
}
return NextResponse.json({
status: 'healthy',
checks
})
} catch (error) {
console.error('Health check failed:', error)
return NextResponse.json(
{
status: 'unhealthy',
error: 'Database connection failed'
},
{ status: 503 }
)
}
}