mirror of
https://github.com/typicode/json-server.git
synced 2025-08-01 06:34:02 +08:00
CLI listen to 'localhost' by default, instead of '0.0.0.0'
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 0.14.0 - 2018-06-09
|
||||||
|
|
||||||
|
* Listen to `localhost` by default, instead of `0.0.0.0`
|
||||||
|
|
||||||
## 0.13.0 - 2018-05-30
|
## 0.13.0 - 2018-05-30
|
||||||
|
|
||||||
* Bundle all index page assets so that you access it without network connection
|
* Bundle all index page assets so that you access it without network connection
|
||||||
|
@ -362,7 +362,7 @@ json-server [options] <source>
|
|||||||
Options:
|
Options:
|
||||||
--config, -c Path to config file [default: "json-server.json"]
|
--config, -c Path to config file [default: "json-server.json"]
|
||||||
--port, -p Set port [default: 3000]
|
--port, -p Set port [default: 3000]
|
||||||
--host, -H Set host [default: "0.0.0.0"]
|
--host, -H Set host [default: "localhost"]
|
||||||
--watch, -w Watch file(s) [boolean]
|
--watch, -w Watch file(s) [boolean]
|
||||||
--routes, -r Path to routes file
|
--routes, -r Path to routes file
|
||||||
--middlewares, -m Paths to middleware files [array]
|
--middlewares, -m Paths to middleware files [array]
|
||||||
|
@ -18,7 +18,7 @@ module.exports = function() {
|
|||||||
host: {
|
host: {
|
||||||
alias: 'H',
|
alias: 'H',
|
||||||
description: 'Set host',
|
description: 'Set host',
|
||||||
default: '0.0.0.0'
|
default: 'localhost'
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
alias: 'w',
|
alias: 'w',
|
||||||
|
@ -16,9 +16,7 @@ const example = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function prettyPrint(argv, object, rules) {
|
function prettyPrint(argv, object, rules) {
|
||||||
const host = argv.host === '0.0.0.0' ? 'localhost' : argv.host
|
const root = `http://${argv.host}:${argv.port}`
|
||||||
const port = argv.port
|
|
||||||
const root = `http://${host}:${port}`
|
|
||||||
|
|
||||||
console.log()
|
console.log()
|
||||||
console.log(chalk.bold(' Resources'))
|
console.log(chalk.bold(' Resources'))
|
||||||
|
Reference in New Issue
Block a user