generated from nholtware/service-template-express
19 lines
927 B
Markdown
19 lines
927 B
Markdown
# adventure
|
|
|
|
Backend for the choose-your-adventure builder/player (Express 5 + Postgres), scaffolded
|
|
by `platform/new-service adventure --kind backend --with postgres`. Frontend: `adventure-web`.
|
|
|
|
A story is one JSONB doc: `{ start, nodes: { key: { title, text, ending?, choices: [{label, to}] } } }`.
|
|
Validation (`src/lib/story.ts`): errors block publishing (missing start/targets, dead ends,
|
|
no reachable ending); warnings are advisory (unreachable scenes, choices on endings).
|
|
|
|
| Method | Path | |
|
|
|--------|------|-|
|
|
| GET | `/stories` | published stories (`?mine=1` includes drafts) |
|
|
| GET | `/stories/:id` | story + `issues` |
|
|
| POST / PUT | `/stories`, `/stories/:id` | create / replace; 400 on bad shape |
|
|
| POST | `/stories/:id/publish` | 422 + `issues` if errors |
|
|
| POST | `/stories/:id/unpublish` | |
|
|
| DELETE | `/stories/:id` | 204 |
|
|
|
|
No auth (homelab). Without `DATABASE_URL` an in-memory store is used (tests).
|