official documentation显示正在设置的非常简单的设置
app.get('title');
// => undefined
app.set('title', 'My Site');
app.get('title');
// => "My Site"
log('Save configuration values in app %j', config);
app.set('config', config);
log('Setting port as %d', config.app.port);
app.set('port', config.app.port);
log('Setting view engine as %s', 'jade');
app.set('view engine', 'jade');
用该方法设置。这绝对不是那么微不足道的。
这里到底发生了什么官方文档中没有详细说明的事情?
最佳答案
Going straight to the source , app.set
似乎没有什么特别的地方。它只是更新一个内部 settings
属性,该属性是一个看似包含任何内容的对象。对于 Balloons.IO:
但是,express 确实有一些内部使用的特殊设置 in the express documentation here .
其他使用express的库也可能有它们内部使用的设置。
关于node.js - app.set() 可以设置哪些设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22491053/