Default configuration

Create the config directory in a root of the project. It will contain the configuration files of application.

Create a basic configuration file (config/default.js). It contains a port of web server.


module.exports = {
  port: 8888

Basic configuration can be extended by using files that have the same name as a value of variable environment NODE_ENV (eg development, production).

Create the config/development.js file.


module.exports = {
  port: 3000

Now the web server will run on port 3000, if the environment variable is set to NODE_ENV=development. In another case, the server will run on port 8888 from the base configuration.