diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-06-06 13:25:10 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-06-06 13:25:10 -0700 |
| commit | bc183a487c97b96041507091854958fc78d22011 (patch) | |
| tree | 6b6c9d540bd4af05e173bbf1d38de60ea6f4a805 /server/select.ts | |
| parent | d3bd7f522ef750d809e9cdb6067a34dc3d1a9273 (diff) | |
server: seperate backend logic into routers
Diffstat (limited to 'server/select.ts')
| -rw-r--r-- | server/select.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/select.ts b/server/select.ts new file mode 100644 index 0000000..d209c38 --- /dev/null +++ b/server/select.ts @@ -0,0 +1,13 @@ +import { Router } from "express"; +import { songs } from "./data/songs"; +import { obfuscateSong } from "./shared"; + +export const selectRouter = Router(); + +selectRouter.get("/select", (_req, res) => { + const song = songs[Math.floor(Math.random() * songs.length)]; + + res.json({ + data: obfuscateSong(song), + }); +}); |
