Skip to content

Commit

Permalink
Added customizable host.
Browse files Browse the repository at this point in the history
Use 'HOST=0.0.0.0 node app.js' to listen on all ip's.
  • Loading branch information
52871299hzy committed Oct 23, 2019
1 parent c0ff65b commit 9bf9ddd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9bf9ddd

Please sign in to comment.