import type { APIRoute } from 'astro'; import { getVigilanceSnapshot } from '../../lib/vigilance'; export const prerender = false; // JSON public du snapshot Vigilance actuel — réutilisable sous Licence Ouverte 2.0. export const GET: APIRoute = async () => { try { const snap = await getVigilanceSnapshot(); return new Response(JSON.stringify(snap), { status: 200, headers: { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'public, max-age=300', 'Access-Control-Allow-Origin': '*', }, }); } catch (e) { return new Response( JSON.stringify({ error: 'fetch_failed', detail: (e as Error).message }), { status: 502, headers: { 'Content-Type': 'application/json' } }, ); } };