From 4d5c8643f300c57329cfe915bf6776f1f22a0cf2 Mon Sep 17 00:00:00 2001 From: Maria Shaldybina Date: Wed, 6 Jun 2012 17:30:43 -0700 Subject: [PATCH] Call to app.address() after server listening event, based on joyent/node@d3f6b094c71a8d2c78dc6cd8bb50b01db6d38e27 --- app.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app.js b/app.js index 00fce0e87..4b3af95d8 100644 --- a/app.js +++ b/app.js @@ -52,7 +52,7 @@ function bootApplication(next) { app.config.init(function(err) { if(err) return console.error(err.message); - + // Default Theme calipso.defaultTheme = app.config.get('themes:default'); @@ -61,7 +61,7 @@ function bootApplication(next) { app.use(express.cookieParser()); app.use(express.responseTime()); - // Create dummy session middleware - tag it so we can later replace + // Create dummy session middleware - tag it so we can later replace var temporarySession = app.config.get('installed') ? {} : express.session({ secret: "installing calipso is great fun" }); temporarySession.tag = "session"; app.use(temporarySession); @@ -107,8 +107,8 @@ function bootApplication(next) { app.use(translate.translate(app.config.get('i18n:language'), app.config.get('i18n:languages'), app.config.get('i18n:additive'))); // Core calipso router - calipso.init(app, function() { - + calipso.init(app, function() { + // Add the calipso mw app.use(calipso.routingFn()); @@ -118,7 +118,7 @@ function bootApplication(next) { }) }); - + } /** @@ -140,10 +140,11 @@ if (!module.parent) { exports.boot(false, function (app) { if (app) { - app.listen(port); - console.log("Calipso version: ".green + app.about.version); - console.log("Calipso configured for: ".green + (global.process.env.NODE_ENV || 'development') + " environment.".green); - console.log("Calipso server listening on port: ".green + app.address().port); + app.listen(port, function () { + console.log("Calipso version: ".green + app.about.version); + console.log("Calipso configured for: ".green + (global.process.env.NODE_ENV || 'development') + " environment.".green); + console.log("Calipso server listening on port: ".green + app.address().port); + }); } else { console.log("\r\nCalipso terminated ...\r\n".grey); process.exit();