| Start |
|---|
| Accessing environment variables The It returns an object like this one : If you set environment variable |
| process.argv command line arguments process.argv (opens new window) is an array containing the command line arguments. The first element will be Code Example: Output sum of all command line arguments
Usage Exaple: Output will be A brief explanation of the code: Here in for loop Converting to number |
| Using different Properties/Configuration for different environments like dev, qa, staging etc. 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 environment. Following code in application will export respective property file which we want to use. Suppose the code is in environment.js We give arguments to the application like following if we are using process manager like forever than it as simple as How to use the configuration file |
Loading environment properties from a "property file"
or |
Read Article
https://develop.horje.com/learn/1434/reference