CLI listen to 'localhost' by default, instead of '0.0.0.0'

This commit is contained in:
typicode
2018-06-09 01:16:41 +02:00
parent fa23dd1c4b
commit 6cdcb32aac
4 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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]

View File

@ -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',

View File

@ -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'))