Permalink
Browse files

Merge pull request #165 from AlekSi/address-fix

Bind on specific address or UNIX socket.
  • Loading branch information...
2 parents 32f74c1 + 72fa628 commit 4b54a8879d3f180f41ee894fc1ea37cd21309488 @mansilladev mansilladev committed Apr 4, 2014
Showing with 9 additions and 5 deletions.
  1. +9 −5 app.js
View
@@ -1018,9 +1018,13 @@ app.get('/:api([^\.]+)', function(req, res) {
// Only listen on $ node app.js
if (!module.parent) {
- var port = process.env.PORT || config.port;
- var l = app.listen(port);
- l.on('listening', function(err) {
- console.log("Express server listening on port %d", port);
- });
+ if (typeof config.socket != "undefined") {
+ var args = [config.socket];
+ console.log("Express server starting on UNIX socket %s", args[0]);
+ } 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.