/** * `GET /api/v1/weather`. * * Always 200, always a body. A source that is down, misconfigured or absent * produces `synthetic: true` and a clear day — there is no failure mode here in * which the caller has to decide what to render, because the answer to "what is * the sky doing" is never allowed to be a 503. */ import type { FastifyInstance } from "fastify"; import { publicCache } from "../cache.ts"; import type { Services } from "../services.ts"; export function registerWeather(app: FastifyInstance, services: Services): void { app.get("/api/v1/weather", async (req, reply) => { const body = await services.weather.current(); publicCache(req, reply, services.config.weather.ttlSeconds); return body; }); }