jevstrudel.git / website / src / pages / jev / songs.json.js

The ids of the site's songs ("<theme>/<song>"), for the Worker: it counts "do you agree with Jev?" votes only for songs this deploy has (worker/src/votes.ts reads this file through its ASSETS binding, and from the dev server in dev). One entry per songs/<theme>/<song>/SPEC.md, the same glob the song index (jev/songs.mjs) builds from.

6const specs = import.meta.glob('../../../../songs/*/*/SPEC.md');
8const songIds = () =>
9  Object.keys(specs)
10    .map((path) => path.split('/songs/')[1].slice(0, -'/SPEC.md'.length))
11    .sort();
12
13export function GET() {
14  return new Response(JSON.stringify({ songs: songIds() }), { headers: { 'Content-Type': 'application/json' } });
15}