import { NextResponse } from 'next/server'; import { getRedisInfo, getStats, INDEX_NAME } from '@/lib/redis'; export async function GET() { try { // Check Redis connection and get info const redisInfo = await getRedisInfo(); // Get index stats const stats = await getStats(); return NextResponse.json({ status: 'ok', redis: { connected: redisInfo.connected, version: redisInfo.version, usedMemory: redisInfo.usedMemory, dbSize: redisInfo.dbSize }, index: { exists: true, name: INDEX_NAME, stats: { documentCount: stats.count, indexSize: stats.size } } }); } catch (error) { console.error('Health check error:', error); return NextResponse.json( { status: 'error', error: error instanceof Error ? error.message : 'Unknown error' }, { status: 503 } ); } }