Permalink
Browse files

update examples for express3.0

  • Loading branch information...
1 parent 081f915 commit 7ac88ba121dadcb84e1c1434815dd79257349a0d @shaunlee committed Dec 9, 2013
Showing with 7 additions and 6 deletions.
  1. +7 −6 examples/app.js
View
13 examples/app.js
@@ -7,7 +7,7 @@ var express = require('express'),
jst = require('jst'),
locales = require('locales');
-var app = module.exports = express.createServer();
+var app = module.exports = express();
// Configuration
@@ -18,6 +18,7 @@ locales.configure({
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jst');
+ app.engine('jst', jst.renderFile);
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(function(req, res, next) { req.lang = 'zh_CN'; next(); });
@@ -34,10 +35,10 @@ app.configure('production', function(){
app.use(express.errorHandler());
});
-app.helpers({
- _: locales.gettext,
- _n: locales.ngettext
-});
+app.locals = {
+ _: locales.gettext,
+ _n: locales.ngettext
+};
// Routes
@@ -51,5 +52,5 @@ app.get('/', function(req, res){
if (!module.parent) {
app.listen(3000);
- console.log("Express server listening on port %d", app.address().port);
+ console.log("Express server listening on port %d", 3000);
}

0 comments on commit 7ac88ba

Please sign in to comment.