jevstrudel.git / website / src / pages / jev / catalog.json.js
1// The site's songs as the hosted MCP lists them (worker/src/catalog.ts,
2// list_songs): id, title, theme, description, Jev's recorded art score and
3// length. Each song whole is catalog/<theme>/<song>.json beside it.
4import { loadSongs } from '../../jev/songs.mjs';
5
6export async function GET() {
7  const songs = (await loadSongs()).map((s) => ({
8    id: s.id,
9    title: s.title,
10    theme: s.theme,
11    description: s.description,
12    art: s.art?.p ?? null,
13    seconds: s.timing?.seconds ?? null,
14  }));
15  return new Response(JSON.stringify({ songs }), { headers: { 'Content-Type': 'application/json' } });
16}