快速配置的最佳实践

时间:2013-06-06 02:52:33

标签: javascript node.js express passport.js

这是我在app.js中的配置

app.set('port',26000 || process.env.PORT);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser({uploadDir:'./public/uploads/'}));
app.use(express.cookieParser('impresionesbr'));
app.use(express.session());
app.use(passport.initialize());
app.use(passport.session());

app.configure('development', function(){
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
    app.use(express.errorHandler());
});

app.listen(26000,'localhost', function(){
    console.log("Express server listening on port %d in %s mode", app.get('port'),
    app.settings.env);
});

但我对如何配置护照有一些疑问,在下一个文件中我可以替代以前的

app2.js

app.set('port',26000 || process.env.PORT);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser({uploadDir:'./public/uploads/'}));
app.use(express.cookieParser('impresionesbr'));
//app.use(express.session());
app.use(passport.session());
app.use(passport.initialize());

app.listen(26000,'localhost', function(){
    console.log("Express server listening on port %d in %s mode", app.get('port'),
    app.settings.env);
});

什么是开发和生产配置???

如果我丢弃那些物品会发生什么?

TNX

0 个答案:

没有答案