Skip to content

Commit

Permalink
Server addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Johnson committed Jun 28, 2017
1 parent f12e966 commit 474888f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server.js
15 changes: 12 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ var http = require('http').Server(app);
var io = require('socket.io')(http);
var path = require('path');

var ip = process.argv[2] || undefined;
var port = process.argv[3] || process.env.PORT || 8080;

// Default server setup.
http.listen(Number(process.argv[3]), process.argv[2], function() {
console.log('listening on ' + process.argv[2] + ':' + process.argv[3]);
});
if(ip !== undefined) {
http.listen(port, ip, function() {
console.log('listening on ' + ip + ':' + port);
});
} else {
http.listen(port, function() {
console.log('listening on ' + ip + ':' + port);
});
}

// Look for resources in these folders.
app.use('/css', express.static(path.join('client', 'css')));
Expand Down

0 comments on commit 474888f

Please sign in to comment.