Tutorial by Examples

The process.env property returns an object containing the user environment. It returns an object like this one : { TERM: 'xterm-256color', SHELL: '/usr/local/bin/bash', USER: 'maciej', PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', PWD: '/Users/maciej', EDITOR: 'vi...
process.argv is an array containing the command line arguments. The first element will be node, the second element will be the name of the JavaScript file. The next elements will be any additional command line arguments. Code Example: Output sum of all command line arguments index.js var sum = 0...
Large scale applications often need different properties when running on different environments. we can achieve this by passing arguments to NodeJs application and using same argument in node process to load specific environment property file. Suppose we have two property files for different enviro...
Install properties reader: npm install properties-reader --save Create a directory env to store your properties files: mkdir env Create environments.js: process.argv.forEach(function (val, index, array) { var arg = val.split("="); if (arg.length > 0) { ...

Page 1 of 1