diff --git a/index.js b/index.js index 77be25229..d1d6a7a1e 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ const app = require('express')(); const http = require('http').Server(app); const io = require('socket.io')(http); +const host = process.env.HOST || 'localhost'; const port = process.env.PORT || 3000; app.get('/', (req, res) => { @@ -13,6 +14,6 @@ io.on('connection', (socket) => { }); }); -http.listen(port, () => { - console.log(`Socket.IO server running at http://localhost:${port}/`); +http.listen(port, host, () => { + console.log(`Socket.IO server running at http://${host}:${port}/`); });