import redis from '@/lib/redis'; import { supabase } from '@/lib/supabase'; export default async function handler(_: any, res: { status: (arg0: number) => { (): any; new(): any; json: { (arg0: { status: string; error?: any; }): void; new(): any; }; }; }) { try { // Verifica conexão com Redis await redis.ping(); // Verifica conexão com Supabase const { data, error } = await supabase.from('stories').select('id').limit(1); if (error) throw error; res.status(200).json({ status: 'healthy' }); } catch (error: unknown) { if (error instanceof Error) { res.status(500).json({ status: 'unhealthy', error: error.message }); } else { res.status(500).json({ status: 'unhealthy', error: 'Erro desconhecido' }); } } }