28 lines
700 B
TypeScript
28 lines
700 B
TypeScript
/**
|
|
* Health Check Endpoint
|
|
* Used by Kubernetes liveness and readiness probes
|
|
*/
|
|
|
|
export async function GET() {
|
|
try {
|
|
// Basic health check - returns 200 if app is running
|
|
const healthData = {
|
|
status: 'healthy',
|
|
timestamp: new Date().toISOString(),
|
|
uptime: process.uptime(),
|
|
environment: process.env.NODE_ENV || 'development',
|
|
};
|
|
|
|
return Response.json(healthData, { status: 200 });
|
|
} catch (error) {
|
|
return Response.json(
|
|
{
|
|
status: 'unhealthy',
|
|
error: error instanceof Error ? error.message : 'Unknown error',
|
|
timestamp: new Date().toISOString(),
|
|
},
|
|
{ status: 503 }
|
|
);
|
|
}
|
|
}
|