Update README.md

This commit is contained in:
typicode
2016-11-10 12:57:48 +01:00
committed by GitHub
parent 0861dfe581
commit 44bdfb490a

View File

@ -354,7 +354,15 @@ server.listen(3000, function () {
$ node server.js
```
For an in-memory database, you can pass an object to `jsonServer.router()`.
The path you provide to the `jsonServer.router` function is relative to the directory from where you launch your node process. If you run the above code from another directory, its better to use an absolute path:
```js
var path = require('path')
var router = jsonServer.router(path.join(__dirname, 'db.json'))
```
For an in-memory database, simply pass an object to `jsonServer.router()`.
Please note also that `jsonServer.router()` can be used in existing Express projects.
#### Custom routes example