Astro 5 SSR + ioredis cache Valkey, déployable sur shared-net. - Vigilance temps réel via Opendatasoft (no-auth, LOv2) - Carte SVG des 96 départements (gregoiredavid/france-geojson) - Climato T° 30j par dept (CSV.GZ Météo France, cache 24h) - Conseils officiels par phénomène (7 types Vigilance) - /api/health (UptimeRobot) + /api/vigilance (JSON public CORS *) - Dockerfile multi-stage, CI Forgejo deploy.yml (pattern Reteno) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
24 lines
777 B
TypeScript
24 lines
777 B
TypeScript
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' } },
|
|
);
|
|
}
|
|
};
|