Question

The official documentation shows a very trivial setting being set

app.get('title');
// => undefined

app.set('title', 'My Site');
app.get('title');
// => "My Site"

But I've seen things like

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

being set with that method. Which are definitely not as trivial.

What exactly is happening here that isn't detailed in the official doc?

Was it helpful?

Solution

Going straight to the source, there doesn't seem to be anything special about app.set at all. It just updates an internal settings property that is an object containing seemingly anything. For Balloons.IO:

  • port to set the server port
  • config (also used in other places, but it's retrieved the same way)

However, express does have some special settings that it uses internally in the express documentation here.

Other libraries that use express may also have settings that they use internally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top