adding 'la suite territoriale' specific gaufre button/endpoint

This commit is contained in:
Emmanuel Pelletier
2024-05-02 12:58:24 +02:00
parent 001ca61773
commit c041c77360
9 changed files with 300 additions and 232 deletions

View File

@@ -0,0 +1,18 @@
import type { APIContext } from "astro"
import services from "@/data/services-local.json"
export async function GET({ url }: APIContext) {
const response = new Response(
JSON.stringify(
services
.filter(({ enabled }) => !!enabled)
.map((service) => ({
id: service.id,
name: service.name,
url: new URL(`/services/${service.id}`, url).toString(),
})),
),
)
response.headers.set("Content-Type", "application/json")
return response
}