Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode authored Nov 10, 2016
1 parent 0861dfe commit 44bdfb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, it’s 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
Expand Down

0 comments on commit 44bdfb4

Please sign in to comment.