Bind to 127.0.0.1 on Windows only

This commit is contained in:
Daniel Imms 2016-06-22 20:43:41 -07:00
parent 3df272fb92
commit 15cf76c767
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ npm install
npm start
```
Then open http://127.0.0.1:3000 in a web browser.
Then open http://0.0.0.0:3000 in a web browser (use http://127.0.0.1:3000 is running under Windows).
## Addons

View File

@ -1,6 +1,7 @@
var express = require('express');
var app = express();
var expressWs = require('express-ws')(app);
var os = require('os');
var pty = require('pty.js');
app.use('/src', express.static(__dirname + '/../src'));
@ -46,7 +47,7 @@ app.ws('/bash', function(ws, req) {
});
var port = process.env.PORT || 3000,
host = '127.0.0.1';
host = os.platform() === 'win32' ? '127.0.0.1' : '0.0.0.0';
console.log('App listening to http://' + host + ':' + port);
app.listen(port, host);