A mock REST API server built on json-server, designed for rapid frontend prototyping and testing. Point your app at saucy-server, and immediately get realistic CRUD endpoints backed by a large JSON dataset — no backend required.
- JSON-based mock API — serves a ~1.3 MB
db.jsonfile as a fully navigable REST API. - Automatic CRUD — every top-level collection in
db.json(posts,comments,albums,photos,users,todos) is exposed withGET(list + detail), and standard create/update/delete semantics out of the box. keyPathquery nesting — pass?keyPath=a.b.cto wrap the response payload inside an object at the given path (e.g. data becomes{a:{b:{c:data}}}), handy for matching an existing client's expected envelope.- Echo mode for non-GET requests —
POST,PUT,PATCH, andDELETErequests echo the request body straight back to the caller, so you can exercise submit flows without persisting anything.
- Node.js
- json-server
^0.10.0 - faker
^4.1.0 - lodash
^4.17.4
git clone https://github.com/saheljalal/saucy-server.git
cd saucy-server
npm installStart the server with:
npm startIt listens on port 3000:
http://localhost:3000
All routes listed below are served from the collections in db.json. The /api/ prefix is rewritten to /, so both /posts and /api/posts resolve to the same resource.
| Method | Behavior |
|---|---|
GET /<collection> |
Returns the full list for any collection in db.json (e.g. posts, users, todos, ...). |
GET /<collection>/:id |
Returns a single item by id. |
POST / PUT / PATCH / DELETE |
Echoes the request body back to the client (no persistence). |
Any GET + ?keyPath=a.b.c |
Wraps the response inside {a:{b:{c:<data>}}}. |
Examples
# list posts
curl http://localhost:3000/posts
# single user
curl http://localhost:3000/users/1
# nest the response under a.b.c
curl 'http://localhost:3000/posts?keyPath=a.b.c'
# -> { "a": { "b": { "c": [ ...posts ] } } }
# echo mode — body is returned as-is
curl -X POST http://localhost:3000/posts \
-H 'Content-Type: application/json' \
-d '{"title":"hello","body":"world"}'
# -> { "title": "hello", "body": "world" }MIT — Copyright (c) 2017 Sahel Jalal.