From 9bf9ddd1997f87cc8991f6c4e18589eb067f523f Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 23 Oct 2019 20:05:07 +0800 Subject: [PATCH] Added customizable host. Use 'HOST=0.0.0.0 node app.js' to listen on all ip's. --- app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 93d730b1e5c..70526a5b183 100644 --- a/app.js +++ b/app.js @@ -83,9 +83,10 @@ fs.readdirSync(path.join(__dirname, 'module')).reverse().forEach(file => { }) const port = process.env.PORT || 3000 +const host = process.env.HOST || 'localhost' -app.server = app.listen(port, () => { - console.log(`server running @ http://localhost:${port}`) +app.server = app.listen(port, host, () => { + console.log(`server running @ http://${host}:${port}`) }) module.exports = app