Neah/app/api/redis/status/route.ts
2025-04-27 14:11:53 +02:00

27 lines
701 B
TypeScript

import { NextResponse } from 'next/server';
import { getRedisClient } from '@/lib/redis';
/**
* API route to check Redis connection status
* Used for monitoring and debugging
*/
export async function GET() {
try {
const redis = getRedisClient();
const pong = await redis.ping();
return NextResponse.json({
status: 'connected',
ping: pong,
timestamp: new Date().toISOString()
});
} catch (error) {
console.error('Redis status check failed:', error);
return NextResponse.json({
status: 'error',
error: error instanceof Error ? error.message : String(error),
timestamp: new Date().toISOString()
}, { status: 500 });
}
}