- Breaking Require Node 8
- Update dependencies
- Fix
db.getState is not a function
- Show error message if port is already used
- Upgrade to lowdb
1.0
- Listen to
localhost
by default, instead of0.0.0.0
- Bundle all index page assets so that you access it without network connection
- Drop Node 4 support
- Add
_delay
query parameter - Upgrade
please-upgrade-node
dependency
- Disable logging for static content requests
- Remove bad
console.log
- Update
dependencies
- Use
nanoid
Re-include body-parser
in jsonServer.defaults()
If you're using JSON Server in an Express server and experience issues, you can disable it by passing
jsonServer.defaults({ bodyParser: false })
Fix engines
field in package.json
Switch to express-urlrewrite to support rewriting query parameters (e.g. /articles?id=1 # → /posts/1
)
If you're rewriting default routes, you'll need to update your routes.json
file
(see add custom routes for updated doc).
- Fix
line-break
error in CLI
- Multiple fields sorting
GET /posts?_sort=user,views&_order=desc,asc
- Drop Node
v0.12
support - Prevent
TypeError
when a filter is applied on anull
value #510
- Update index page
- Improve performances (lowdb
v0.15
) - Add
Location
header to newly created resources #473
- Display custom routes on homepage
- Fix duplicate query params error #352
- Fix #396 PUT/PATCH saves the updated item with an id that has been converted to string
- Shorter
uuid
- No automatic conversion of strings to boolean or integer
- Create a default
db.json
file if it doesn't exist - Fix
- Updated dependencies and codebase to ES6
- Fix
Links
header
- Fix
Links
header issue when using_page
- Add query params support to the route rewriter
- Fix bodyParser issue when using custom routes
- Fix #355
- Add
_page
support
- Fix #341
- Add CLI option
--middlewares
and support them injson-server.json
config file
- Fix snapshot creation for JS files (ex:
json-server generator.js
)
- Support
x-www-form-urlencoded
- Bug fix:
--watch
option on OS X
- Bug fix: data wasn't written to file in
v0.8.13
andv0.8.12
- Make
_like
operator case insensitive
- Minor bug fix
- Support sort by nested field (e.g.
_sort=author.name
) - Fix
graceful-fs
warning
- CLI option
-ng/--no-gzip
to disablegzip
compression
- CLI can now read options from
json-server.json
if present - CLI option
-c/--config
to point to a different configuration file
- Fix #233
gzip
compression to improve performances- CLI option
-nc/--no-cors
to disable CORS
- CLI option
-ro/--read-only
to allow only GET requests
- Fix #177
- 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 return404
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