Migration from Express 2.5 to Express 3.0

Express.createServer(); is deprecated

migrated to
var App = Express();

App.address() not available anymore.
This commit is contained in:
Stéphane Frénot 2012-11-09 11:00:47 +01:00
parent 323878136b
commit 351bcdddcc
2 changed files with 5 additions and 4 deletions

7
app.js
View File

@ -3,7 +3,8 @@ var Routes = require('./routes');
// var TryCatch = require('./trycatch'); // var TryCatch = require('./trycatch');
var App = module.exports = Express.createServer(); //var App = module.exports = Express.createServer();
var App = Express();
// Configuration // Configuration
@ -34,5 +35,5 @@ App.get('/:name', Routes.view);
App.get('/:name/edit', Routes.edit); App.get('/:name/edit', Routes.edit);
App.post('/:name', Routes.save); App.post('/:name', Routes.save);
App.listen(process.env.PORT || 3000); server = App.listen(process.env.PORT || 3000);
console.log("Express server listening on port %d in %s mode", App.address().port, App.settings.env); console.log("Express server listening on port %d in %s mode", server.address().port, App.settings.env);

View File

@ -3,7 +3,7 @@
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"express": "2.5.5", "express": "3.0.2",
"jade": ">= 0.0.1", "jade": ">= 0.0.1",
"markdown": "~0.3.1", "markdown": "~0.3.1",
"trycatch": "~0.0.9" "trycatch": "~0.0.9"