27 lines
701 B
TypeScript
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 });
|
|
}
|
|
}
|