Skip to content

Commit f23ad4b

Browse files
committed
Add config file support
1 parent 841bd7f commit f23ad4b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [0.8.9][2016-03-17]
4+
5+
* CLI can now read options from `json-server.json` if present
6+
* CLI option `-c/--config` to point to a different configuration file
7+
38
## [0.8.8][2016-02-13]
49

510
### Fixed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,41 @@ Now you can access resources using additional routes.
252252
/blog/posts/1/show
253253
```
254254

255+
### CLI usage
256+
257+
```
258+
json-server [options] <source>
259+
260+
Options:
261+
--config, -c Path to config file [default: "json-server.json"]
262+
--port, -p Set port [default: 3000]
263+
--host, -H Set host [default: "0.0.0.0"]
264+
--watch, -w Watch file(s) [boolean]
265+
--routes, -r Path to routes file
266+
--static, -s Set static files directory
267+
--read-only, --ro Allow only GET requests [boolean]
268+
--no-cors, --nc Disable Cross-Origin Resource Sharing [boolean]
269+
--snapshots, -S Set snapshots directory [default: "."]
270+
--delay, -d Add delay to responses (ms)
271+
--id, -i Set database id property (e.g. _id) [default: "id"]
272+
--quiet, -q Suppress log messages from output [boolean]
273+
--help, -h Show help [boolean]
274+
--version, -v Show version number [boolean]
275+
276+
Examples:
277+
bin db.json
278+
bin file.js
279+
bin http://example.com/db.json
280+
```
281+
282+
You can also set options in a `json-server.json` configuration file.
283+
284+
```json
285+
{
286+
"port": 3000
287+
}
288+
```
289+
255290
### Module
256291

257292
If you need to add authentication, validation, you can use the project as a module in combination with other Express middlewares.

0 commit comments

Comments
 (0)