gzip compression to improve performances
- CLI option
-nc/--no-cors to disable CORS
- CLI option
-ro/--read-only to allow only GET requests
- Like operator
GET /posts?title_like=json (accepts RegExp)
- CLI option
-q/--quiet
- Nested route
POST /posts/1/comments
- Not equal operator
GET /posts?id_ne=1
- CLI option
-S/--snapshots to set a custom snapshots directory.
- Fix plural resources:
DELETE should return 404 if resource doesn't exist.
- Fix plural resources:
PUT should replace resource instead of updating properties.
- Fix singular resources:
POST, PUT, PATCH should not convert resource properties.
jsonServer.defaults is now a function and can take an object.
If you're using the project as a module, you need to update your code:
// Before
jsonServer.defaults
// After
jsonServer.defaults()
jsonServer.defaults({ static: '/some/path'})
- Automatically ignore unknown query parameters.
# Before
GET /posts?author=typicode&foo=bar # []
# After
GET /posts?author=typicode&foo=bar # [{...}, {...}]
- CLI option for setting a custom static files directory.
json-server --static some/path
# Support range
GET /products?price_gte=50&price_lte=100
# Support OR
GET /posts?id=1&id2
GET /posts?category=javascript&category=html
# Support embed and expand in lists
GET /posts?embed=comments
GET /posts?expand=user