O'Reilly logo
  • Patrick S thinks this is interesting:

The method app.set(name, value) accepts two parameters: name and value. As you might guess, it sets the value for the name. For example, we often want to store the value of the port on which we plan to start our server:

app.set('port', 3000);

Or, for a more advanced and realistic use case, we can grab the port from system environment variable PORT (process.env.PORT). If the PORT environment variable is undefined, we fall back to the hard-coded value 3000<...


Cover of Pro Express.js


using app.set()