Skip to content

Commit

Permalink
Merge pull request #165 from AlekSi/address-fix
Browse files Browse the repository at this point in the history
Bind on specific address or UNIX socket.
  • Loading branch information
mansilladev committed Apr 4, 2014
2 parents 32f74c1 + 72fa628 commit 4b54a88
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1018,9 +1018,13 @@ app.get('/:api([^\.]+)', function(req, res) {
// Only listen on $ node app.js // Only listen on $ node app.js


if (!module.parent) { if (!module.parent) {
var port = process.env.PORT || config.port; if (typeof config.socket != "undefined") {
var l = app.listen(port); var args = [config.socket];
l.on('listening', function(err) { console.log("Express server starting on UNIX socket %s", args[0]);
console.log("Express server listening on port %d", port); } else {
}); var args = [process.env.PORT || config.port, config.address];
console.log("Express server starting on %s:%d", args[1], args[0]);
}

app.listen.apply(app, args);
} }

0 comments on commit 4b54a88

Please sign in to comment.