json-server 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/lib/cli/index.js +0 -6
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Created with <3 for front-end developers who need a quick back-end for prototypi
|
|
|
11
11
|
See also:
|
|
12
12
|
* :dog: [husky - Git hooks made easy](https://github.com/typicode/husky)
|
|
13
13
|
* :owl: [lowdb - local JSON database](https://github.com/typicode/lowdb)
|
|
14
|
-
*
|
|
14
|
+
* ✅ [xv - a beautifully simple and capable test runner](https://github.com/typicode/xv)
|
|
15
15
|
|
|
16
16
|
<p> </p>
|
|
17
17
|
|
|
@@ -36,16 +36,8 @@ See also:
|
|
|
36
36
|
<p> </p>
|
|
37
37
|
|
|
38
38
|
<p align="center">
|
|
39
|
-
<a href="https://
|
|
40
|
-
<img src="https://jsonplaceholder.typicode.com/
|
|
41
|
-
</a>
|
|
42
|
-
</p>
|
|
43
|
-
|
|
44
|
-
<p> </p>
|
|
45
|
-
|
|
46
|
-
<p align="center">
|
|
47
|
-
<a href="https://uibakery.io/?utm_source=json_server&utm_medium=sponsor&utm_campaign=github" target="_blank">
|
|
48
|
-
<img src="https://jsonplaceholder.typicode.com/ui_bakery.jpg" height="70px">
|
|
39
|
+
<a href="https://megafamous.com/buy-instagram-followers" target="_blank">
|
|
40
|
+
<img src="https://jsonplaceholder.typicode.com/megafamous.png" height="70px">
|
|
49
41
|
</a>
|
|
50
42
|
</p>
|
|
51
43
|
|
|
@@ -53,11 +45,15 @@ See also:
|
|
|
53
45
|
|
|
54
46
|
<p> </p>
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
<h2 align="center">Silver sponsors 🥈</h2>
|
|
57
49
|
|
|
58
|
-
|
|
50
|
+
<p> </p>
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
<p align="center">
|
|
53
|
+
<a href="https://cased.com" target="_blank">
|
|
54
|
+
<img src="https://user-images.githubusercontent.com/5502029/194441951-b7dca49d-efd6-496d-900b-288004717f11.png" height="55px">
|
|
55
|
+
</a>
|
|
56
|
+
</p>
|
|
61
57
|
|
|
62
58
|
<p> </p>
|
|
63
59
|
|
|
@@ -482,6 +478,8 @@ const router = jsonServer.router(path.join(__dirname, 'db.json'))
|
|
|
482
478
|
|
|
483
479
|
For an in-memory database, simply pass an object to `jsonServer.router()`.
|
|
484
480
|
|
|
481
|
+
To add custom options (eg. `foreginKeySuffix`) pass in an object as the second argument to `jsonServer.router('db.json', { foreginKeySuffix: '_id' })`.
|
|
482
|
+
|
|
485
483
|
Please note also that `jsonServer.router()` can be used in existing Express projects.
|
|
486
484
|
|
|
487
485
|
#### Custom routes example
|
|
@@ -603,10 +601,12 @@ Returns middlewares used by JSON Server.
|
|
|
603
601
|
* `noCors` disable CORS (default: false)
|
|
604
602
|
* `readOnly` accept only GET requests (default: false)
|
|
605
603
|
|
|
606
|
-
__`jsonServer.router([path|object])`__
|
|
604
|
+
__`jsonServer.router([path|object], [options])`__
|
|
607
605
|
|
|
608
606
|
Returns JSON Server router.
|
|
609
607
|
|
|
608
|
+
* options (see [CLI usage](#cli-usage))
|
|
609
|
+
|
|
610
610
|
### Deployment
|
|
611
611
|
|
|
612
612
|
You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholder.typicode.com) is an online fake API powered by JSON Server and running on Heroku.
|
package/lib/cli/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const updateNotifier = require('update-notifier');
|
|
4
|
-
|
|
5
3
|
const yargs = require('yargs');
|
|
6
4
|
|
|
7
5
|
const run = require('./run');
|
|
@@ -9,10 +7,6 @@ const run = require('./run');
|
|
|
9
7
|
const pkg = require('../../package.json');
|
|
10
8
|
|
|
11
9
|
module.exports = function () {
|
|
12
|
-
updateNotifier({
|
|
13
|
-
pkg
|
|
14
|
-
}).notify();
|
|
15
|
-
|
|
16
10
|
const argv = yargs.config('config').usage('$0 [options] <source>').options({
|
|
17
11
|
port: {
|
|
18
12
|
alias: 'p',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-server",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Get a full fake REST API with zero coding in less than 30 seconds",
|
|
5
5
|
"main": "./lib/server/index.js",
|
|
6
6
|
"bin": "./lib/cli/bin.js",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"please-upgrade-node": "^3.2.0",
|
|
39
39
|
"pluralize": "^8.0.0",
|
|
40
40
|
"server-destroy": "^1.0.1",
|
|
41
|
-
"update-notifier": "^5.1.0",
|
|
42
41
|
"yargs": "^17.0.1"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|