Setting and getting application options

An Express application has a set of predefined application variables that are used to configure various options of the app. These variables are used for setting various dynamic aspects of the app and can be set using the app.set() method. So far we have used two of them:

app.set('view engine', 'jade');
app.set('views', './views');

The values of application variables can be retrieved using the corresponding app.get() method.

The following table lists all the options that can be configured in an Express app:

Option

Purpose

env

The environment the app is running on. Not recommended to set manually. You will read more about this in the next section.

trust proxy

Enables reverse proxy.

jsonp callback name ...

Get Express Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.