Title here
Summary here
roji can return mock responses without a real backend, which is useful for frontend development when the API isn’t ready yet.
Define mock responses using Docker labels on any container. The container doesn’t need to run a web server — it just needs to be connected to the roji network.
| Label | Description |
|---|---|
roji.mock.{METHOD}.{PATH} | Response body (JSON string) |
roji.mock.status.{METHOD}.{PATH} | HTTP status code (default: 200) |
services:
mock-api:
image: alpine
command: ["sleep", "infinity"]
labels:
- "roji.host=api.dev.localhost"
- 'roji.mock.GET./api/users=[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]'
- 'roji.mock.GET./api/health={"status":"ok"}'
- "roji.mock.status.POST./api/users=201"
networks:
- roji
networks:
roji:
external: trueThis creates:
GET https://api.dev.localhost/api/users → 200 with user list JSONGET https://api.dev.localhost/api/health → 200 with health statusPOST https://api.dev.localhost/api/users → 201 (empty body)labels:
- "roji.mock.GET./api/error={\"error\":\"Internal Server Error\"}"
- "roji.mock.status.GET./api/error=500"