// 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');
}