mirror of
https://github.com/luxfhe/research-ocp-fhe.git
synced 2026-11-03 06:05:38 +00:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { NextResponse } from 'next/server';
|
|
import { checkRedisHealth } from '@/lib/redis';
|
|
|
|
// GET /api/health - Health check endpoint
|
|
export async function GET() {
|
|
try {
|
|
// Test Redis connection
|
|
const redisStatus = await checkRedisHealth();
|
|
|
|
return NextResponse.json({
|
|
status: redisStatus ? 'healthy' : 'unhealthy',
|
|
timestamp: new Date().toISOString(),
|
|
service: 'Next.js Company API with Upstash Redis',
|
|
redis: {
|
|
status: redisStatus ? 'connected' : 'disconnected',
|
|
provider: 'Upstash'
|
|
}
|
|
});
|
|
} catch (error) {
|
|
console.error('Health check failed:', error);
|
|
|
|
return NextResponse.json(
|
|
{
|
|
status: 'unhealthy',
|
|
timestamp: new Date().toISOString(),
|
|
service: 'Next.js Company API with Upstash Redis',
|
|
error: 'Redis connection failed',
|
|
message: error instanceof Error ? error.message : 'Unknown error'
|
|
},
|
|
{ status: 503 }
|
|
);
|
|
}
|
|
}
|