Enviroment Config at Express.js

Posted in Node.js, Express.js, on 8/2/2014


1. nconf

nconfig is very powerful configuration module in node.js, it is key value store, plugablle, able to use with redis


When you use it, you can create following different kind of enviroment variable. 

One if the config file, development.json might looks like following.

2. Write your own config

Instead of using nconfig, you can use following javascript to write your own.

inside the config.js, use lodash to merge default config and enviroment specific config value.

You can use set NODE_ENV=development to change node.js enviroment variable for your application.