A minimal Express 5 ESM API used as a TestAtlas reference example. The
companion _testatlas/ workspace inside this directory is the durable
quality intelligence layer produced by mapping this codebase end-to-end.
- Plain ESM (
"type": "module"), Node 20.11+, no build step - 4 route modules:
health,auth,tasks,users - In-memory store (Map) for tasks; mock bearer-token auth
- ~150 LOC across
server.js+routes/+lib/
npm install
node server.js
# → example-node-api listening on http://localhost:3000Available endpoints:
| Method | Path | Notes |
|---|---|---|
GET |
/api/health |
Liveness probe → {status: "ok"} |
POST |
/api/auth/login |
Returns mock JWT on any non-empty input |
POST |
/api/auth/logout |
204 |
GET |
/api/tasks |
List all tasks |
POST |
/api/tasks |
Create task |
GET |
/api/tasks/:id |
Get task |
PATCH |
/api/tasks/:id |
Update task |
DELETE |
/api/tasks/:id |
Delete task — missing ownership check |
GET |
/api/users/me |
Requires Authorization: Bearer mock-jwt-token |
The _testatlas/ directory next to this README is regenerable from
_testatlas-fixture/example-script.json via:
node ../../scripts/regenerate-example.js examples/node-api--check mode (used by CI in plan 08-04) runs the regeneration against a
tempdir and exits non-zero if the checked-in tree drifts from replay
output — see examples/framework/README.md.
Three findings are intentionally seeded into this example so the workspace demonstrates real-looking issues:
- NO-AUTH-ON-DELETE-TASK (medium) —
DELETE /api/tasks/:iddoes not verify the requester owns the task. - IN-MEMORY-STORE-DATA-LOSS (enhancement) — a process restart wipes all task state.
- MOCK-JWT-SECRET-LITERAL (low) —
.env.exampleships a string that reads like a real secret.
See _testatlas/to_fix/ for the full issue records (severity, repro,
acceptance criteria, evidence).