json-server 0.17.1 → 0.17.2
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 +9 -1
- package/lib/cli/utils/is.js +1 -1
- package/lib/server/router/validate-data.js +2 -1
- package/package.json +2 -1
- package/public/script.js +4 -4
package/README.md
CHANGED
|
@@ -43,6 +43,14 @@ See also:
|
|
|
43
43
|
|
|
44
44
|
<p> </p>
|
|
45
45
|
|
|
46
|
+
<p align="center">
|
|
47
|
+
<a href="http://asocks.com/c/TFw5bz" target="_blank">
|
|
48
|
+
<img src="https://jsonplaceholder.typicode.com/asocks.png" height="70px">
|
|
49
|
+
</a>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p> </p>
|
|
53
|
+
|
|
46
54
|
<p> </p>
|
|
47
55
|
|
|
48
56
|
<h2 align="center">Silver sponsors 🥈</h2>
|
|
@@ -348,7 +356,7 @@ module.exports = () => {
|
|
|
348
356
|
$ json-server index.js
|
|
349
357
|
```
|
|
350
358
|
|
|
351
|
-
__Tip__ use modules like [Faker](https://github.com/
|
|
359
|
+
__Tip__ use modules like [Faker](https://github.com/faker-js/faker), [Casual](https://github.com/boo1ean/casual), [Chance](https://github.com/victorquinn/chancejs) or [JSON Schema Faker](https://github.com/json-schema-faker/json-schema-faker).
|
|
352
360
|
|
|
353
361
|
### HTTPS
|
|
354
362
|
|
package/lib/cli/utils/is.js
CHANGED
|
@@ -13,6 +13,7 @@ module.exports = obj => {
|
|
|
13
13
|
if (_.isPlainObject(obj)) {
|
|
14
14
|
Object.keys(obj).forEach(validateKey);
|
|
15
15
|
} else {
|
|
16
|
-
throw new Error(`Data must be an object. Found ${
|
|
16
|
+
throw new Error(`Data must be an object. Found ${Array.isArray(obj) ? 'array' : typeof obj}
|
|
17
|
+
'See https://github.com/typicode/json-server for example.`);
|
|
17
18
|
}
|
|
18
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-server",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
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,6 +38,7 @@
|
|
|
38
38
|
"please-upgrade-node": "^3.2.0",
|
|
39
39
|
"pluralize": "^8.0.0",
|
|
40
40
|
"server-destroy": "^1.0.1",
|
|
41
|
+
"standard": "^17.0.0",
|
|
41
42
|
"yargs": "^17.0.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
package/public/script.js
CHANGED
|
@@ -15,7 +15,7 @@ function ResourceList({ db }) {
|
|
|
15
15
|
ResourceItem({
|
|
16
16
|
name,
|
|
17
17
|
length: Array.isArray(db[name]) && db[name].length,
|
|
18
|
-
})
|
|
18
|
+
}),
|
|
19
19
|
)
|
|
20
20
|
.join('')}
|
|
21
21
|
</ul>
|
|
@@ -40,7 +40,7 @@ window
|
|
|
40
40
|
.then((response) => response.json())
|
|
41
41
|
.then(
|
|
42
42
|
(db) =>
|
|
43
|
-
(document.getElementById('resources').innerHTML = ResourcesBlock({ db }))
|
|
43
|
+
(document.getElementById('resources').innerHTML = ResourcesBlock({ db })),
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
function CustomRoutesBlock({ customRoutes }) {
|
|
@@ -56,7 +56,7 @@ function CustomRoutesBlock({ customRoutes }) {
|
|
|
56
56
|
`<tr>
|
|
57
57
|
<td>${rule}</td>
|
|
58
58
|
<td><code>⇢</code> ${customRoutes[rule]}</td>
|
|
59
|
-
</tr
|
|
59
|
+
</tr>`,
|
|
60
60
|
)
|
|
61
61
|
.join('')}
|
|
62
62
|
</table>
|
|
@@ -72,5 +72,5 @@ window
|
|
|
72
72
|
(customRoutes) =>
|
|
73
73
|
(document.getElementById('custom-routes').innerHTML = CustomRoutesBlock({
|
|
74
74
|
customRoutes,
|
|
75
|
-
}))
|
|
75
|
+
})),
|
|
76
76
|
)
|