express基础二:配置文件

// all environments
app.configure(function(){
  app.set('title', 'My Application');
})

// development only
app.configure('development', function(){
  app.set('db uri', 'localhost/dev');
})

// production only
app.configure('production', function(){
  app.set('db uri', 'n.n.n.n/prod');
})
相当于:
// all environments
app.set('title', 'My Application');

// development only
if ('development' == app.get('env')) {
  app.set('db uri', 'localhost/dev');
}

// production only
if ('production' == app.get('env')) {
  app.set('db uri', 'n.n.n.n/prod');
}
posted @ 2013-05-17 13:59  践道者  阅读(360)  评论(0)    收藏  举报