Config File - pcimino/nodejs-restify-mongodb GitHub Wiki

Configuration File

Module Export

module.exports = Provides a way to shortcut references to Object instances and their methods. Rather than regurgitate something I don't fully understand. Here's the official explaination, and this explaination makes it a bit clearer.

Environment Values

Normally the export is set to an object and an alias is used. In this case the export is set to a hash of values and then references in app.js by the key:

var env = process.env.NODE_ENV || 'development'  
, config = require('./config/config')[env]  

The env comes in from the NODE_ENV or defaults to development. The config variable is then set to the config content based on the environment.

Next: Email Configuration

Return Home