Repository navigation
Open
Labels
priority: lowLow prioritystatus: in progressCurrently being worked ontype: featureNew feature or requestworkload: hoursLikely takes hours to resolve
Description
Why
The docs previews need a backend we control (#419). This issue sets up the
empty service so that the API stubs (sibling issues) can be added in small
PRs.
What to do
- Add a workspace
apps/mock-server(TypeScript, Node >= 22, the repo's
engine range), using Node's built-inhttpserver and as few runtime
dependencies as possible. - Router with a 404 JSON default, CORS (any origin,
GET, POST, PUT, DELETE, OPTIONS, preflight answers),GET /healthz, port fromPORT
(default 8080), one log line per request. - In-memory store loaded from deterministic fixture files on start, never
written to disk; a restart resets it. - Abuse limits, since the deployed instance is public and anonymous: a
request body limit (e.g. 1 MiB,413above it) and a cap on created
items per collection (e.g. 100; the oldest created item is dropped, the
fixtures stay). - Integration tests (start the server on a free port, send real HTTP
requests) withnode:test, run by the workspace'stestscript, so the
existing CItestjob (and with it theCI passedgate) runs them; lint
through the existinglintjob. - Docs: a "Mock server" section in the Contributing page (what it is for,
how to run it locally, how to add fixtures, that it has no auth and must
never hold real data).
Done when
-
npm run dev/npm testinapps/mock-serverwork;turbo run testincludes it - Tests cover health, CORS preflight, 404, store reset, the body limit and the item cap
- CI
testandlintrun the new workspace andCI passedis green - Contributing page documents the mock server
Metadata
Metadata
Assignees
Labels
priority: lowLow prioritystatus: in progressCurrently being worked ontype: featureNew feature or requestworkload: hoursLikely takes hours to resolve
Type
Projects
- StatusShow more project fieldsNo status
- StatusShow more project fieldsIn review
Activity