Display localhost instead of 0.0.0.0

This commit is contained in:
Sébastien Chopin 2017-06-11 15:49:01 +02:00 committed by Pooya Parsa
parent 602adf0464
commit 4623170c99

View File

@ -13,7 +13,7 @@ class Server {
this.nuxt.ready() this.nuxt.ready()
.then(() => { .then(() => {
// Add Middleware // Add Middleware
this.options.serverMiddleware.forEach(m => { this.nuxt.options.serverMiddleware.forEach(m => {
this.useMiddleware(m) this.useMiddleware(m)
}) })
// Add default render middleware // Add default render middleware
@ -46,9 +46,15 @@ class Server {
} }
listen (port, host) { listen (port, host) {
host = host || '127.0.0.1' host = host || 'localhost'
port = port || 3000 port = port || 3000
this.nuxt.ready() this.nuxt.ready()
.then(() => {
this.server.listen(port, host, () => {
let _host = host === '0.0.0.0' ? 'localhost' : host
console.log('Ready on http://%s:%s', _host, port) // eslint-disable-line no-console
})
})
.then(() => { .then(() => {
this.server.listen(port, host, () => { this.server.listen(port, host, () => {
console.log('Ready on http://%s:%s', host, port) // eslint-disable-line no-console console.log('Ready on http://%s:%s', host, port) // eslint-disable-line no-console