json-server 0.12.2 → 0.14.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/.babelrc CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "presets": [
3
- ["env", {
4
- "targets": {
5
- "node": 4
6
- },
7
- "exclude": ["transform-regenerator"]
8
- }]
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "6"
8
+ }
9
+ }
10
+ ]
9
11
  ]
10
12
  }
package/.eslintrc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- extends: ['standard', 'prettier'],
2
+ extends: ['standard', 'standard-preact', 'prettier'],
3
3
  plugins: ['prettier'],
4
4
  rules: {
5
5
  'prettier/prettier': [
@@ -10,5 +10,5 @@ module.exports = {
10
10
  },
11
11
  ]
12
12
  },
13
- env: { mocha: true }
13
+ env: { jest: true }
14
14
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.14.2 - 2018-12-26
4
+
5
+ * Fix `db.getState is not a function`
6
+
7
+ ## 0.14.1 - 2018-12-25
8
+
9
+ * Show error message if port is already used
10
+ * Upgrade to [lowdb](https://github.com/typicode/lowdb) `1.0`
11
+
12
+ ## 0.14.0 - 2018-06-09
13
+
14
+ * Listen to `localhost` by default, instead of `0.0.0.0`
15
+
16
+ ## 0.13.0 - 2018-05-30
17
+
18
+ * Bundle all index page assets so that you access it without network connection
19
+ * Drop Node 4 support
20
+
3
21
  ## 0.12.2 - 2018-04-26
4
22
 
5
23
  * Add `_delay` query parameter
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # JSON Server [![](https://travis-ci.org/typicode/json-server.svg?branch=master)](https://travis-ci.org/typicode/json-server) [![](https://badge.fury.io/js/json-server.svg)](http://badge.fury.io/js/json-server) [![](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/typicode/json-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
+ # JSON Server [![](https://travis-ci.org/typicode/json-server.svg?branch=master)](https://travis-ci.org/typicode/json-server) [![](https://badge.fury.io/js/json-server.svg)](http://badge.fury.io/js/json-server)
2
2
 
3
3
  Get a full fake REST API with __zero coding__ in __less than 30 seconds__ (seriously)
4
4
 
@@ -10,18 +10,22 @@ Created with <3 for front-end developers who need a quick back-end for prototypi
10
10
  See also:
11
11
  * :dog: [husky - Git hooks made easy](https://github.com/typicode/husky)
12
12
  * :hotel: [hotel - developer tool with local .localhost domain and https out of the box](https://github.com/typicode/hotel)
13
- * :atom_symbol: [react-fake-props - generate fake props for your React tests (Jest, Enzyme, ...)](https://github.com/typicode/react-fake-props)
14
- * :heartpulse: [Patreon page - if you want to support JSON Server or my other projects](https://www.patreon.com/typicode)
13
+ * ⚛️ 🔧 [react-lodash - lodash as React components](https://github.com/typicode/react-lodash)
15
14
 
16
- ## Table of contents
15
+ <a href="https://www.patreon.com/typicode">
16
+ <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
17
+ </a>
18
+
19
+ ## Sponsors
20
+
21
+ __[[Become a sponsor and have your company logo here]](https://patreon.com/typicode)__
17
22
 
18
- <details>
23
+ ## Table of contents
19
24
 
20
25
  <!-- toc -->
21
26
 
22
27
  - [Sponsorship](#sponsorship)
23
- - [Example](#example)
24
- - [Install](#install)
28
+ - [Getting started](#getting-started)
25
29
  - [Routes](#routes)
26
30
  * [Plural routes](#plural-routes)
27
31
  * [Singular routes](#singular-routes)
@@ -61,11 +65,15 @@ See also:
61
65
 
62
66
  <!-- tocstop -->
63
67
 
64
- </details>
68
+ ## Getting started
69
+
70
+ Install JSON Server
65
71
 
66
- ## Example
72
+ ```
73
+ npm install -g json-server
74
+ ```
67
75
 
68
- Create a `db.json` file
76
+ Create a `db.json` file with some data
69
77
 
70
78
  ```json
71
79
  {
@@ -82,7 +90,7 @@ Create a `db.json` file
82
90
  Start JSON Server
83
91
 
84
92
  ```bash
85
- $ json-server --watch db.json
93
+ json-server --watch db.json
86
94
  ```
87
95
 
88
96
  Now if you go to [http://localhost:3000/posts/1](http://localhost:3000/posts/1), you'll get
@@ -95,15 +103,9 @@ Also when doing requests, it's good to know that:
95
103
 
96
104
  - If you make POST, PUT, PATCH or DELETE requests, changes will be automatically and safely saved to `db.json` using [lowdb](https://github.com/typicode/lowdb).
97
105
  - Your request body JSON should be object enclosed, just like the GET output. (for example `{"name": "Foobar"}`)
98
- - Id values are not mutable. Any `id` value in the body of your PUT or PATCH request wil be ignored. Only a value set in a POST request wil be respected, but only if not already taken.
106
+ - Id values are not mutable. Any `id` value in the body of your PUT or PATCH request will be ignored. Only a value set in a POST request will be respected, but only if not already taken.
99
107
  - A POST, PUT or PATCH request should include a `Content-Type: application/json` header to use the JSON in the request body. Otherwise it will result in a 200 OK but without changes being made to the data.
100
108
 
101
- ## Install
102
-
103
- ```bash
104
- $ npm install -g json-server
105
- ```
106
-
107
109
  ## Routes
108
110
 
109
111
  Based on the previous `db.json` file, here are all the default routes. You can also add [other routes](#add-custom-routes) using `--routes`.
@@ -306,7 +308,7 @@ __Tip__ use modules like [Faker](https://github.com/Marak/faker.js), [Casual](ht
306
308
 
307
309
  ### HTTPS
308
310
 
309
- There's many way to set up SSL in development. One simple way though is to use [hotel](https://github.com/typicode/hotel).
311
+ There are many ways to set up SSL in development. One simple way is to use [hotel](https://github.com/typicode/hotel).
310
312
 
311
313
  ### Add custom routes
312
314
 
@@ -362,7 +364,7 @@ json-server [options] <source>
362
364
  Options:
363
365
  --config, -c Path to config file [default: "json-server.json"]
364
366
  --port, -p Set port [default: 3000]
365
- --host, -H Set host [default: "0.0.0.0"]
367
+ --host, -H Set host [default: "localhost"]
366
368
  --watch, -w Watch file(s) [boolean]
367
369
  --routes, -r Path to routes file
368
370
  --middlewares, -m Paths to middleware files [array]
@@ -575,6 +577,7 @@ You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholde
575
577
  * [Fast prototyping using Restangular and Json-server](http://glebbahmutov.com/blog/fast-prototyping-using-restangular-and-json-server/)
576
578
  * [Create a Mock REST API in Seconds for Prototyping your Frontend](https://coligo.io/create-mock-rest-api-with-json-server/)
577
579
  * [No API? No Problem! Rapid Development via Mock APIs](https://medium.com/@housecor/rapid-development-via-mock-apis-e559087be066#.93d7w8oro)
580
+ * [Zero Code REST With json-server](https://dzone.com/articles/zero-code-rest-with-json-server)
578
581
 
579
582
  ### Third-party tools
580
583
 
@@ -586,4 +589,6 @@ You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholde
586
589
 
587
590
  ## License
588
591
 
589
- MIT - [Typicode](https://github.com/typicode) - [Patreon](https://www.patreon.com/typicode)
592
+ MIT
593
+
594
+ [Patreon](https://www.patreon.com/typicode) - [Supporters](https://thanks.typicode.com) ✨
File without changes
@@ -2,11 +2,7 @@
2
2
 
3
3
  <head>
4
4
  <title>JSON Server</title>
5
- <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
6
- <link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
7
- <link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
8
- <link rel="stylesheet" href="style.css">
9
- </head>
5
+ <link rel="shortcut icon" href="favicon.ico"><link href="main.css" rel="stylesheet"></head>
10
6
 
11
7
  <body>
12
8
  <header>
@@ -53,9 +49,5 @@
53
49
  </p>
54
50
  </div>
55
51
  </footer>
56
-
57
- <script src="https://unpkg.com/mithril/mithril.min.js"></script>
58
- <script src="main.js"></script>
59
- </body>
60
-
61
- </html>
52
+ <script type="text/javascript" src="main.js"></script></body>
53
+ </html>