Seed from NAS prod snapshot 20260130-190531
This commit is contained in:
22
src/pages/api/glossaire.json.ts
Normal file
22
src/pages/api/glossaire.json.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { APIRoute } from "astro";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export const prerender = true;
|
||||
|
||||
export const GET: APIRoute = async () => {
|
||||
const entries = await getCollection("glossaire");
|
||||
const index = entries.map((e) => ({
|
||||
slug: e.slug,
|
||||
term: e.data.term,
|
||||
aliases: e.data.aliases ?? [],
|
||||
definitionShort: e.data.definitionShort,
|
||||
href: `/glossaire/${e.slug}/`,
|
||||
}));
|
||||
|
||||
return new Response(JSON.stringify(index), {
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "public, max-age=3600",
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user