title: Node js express project how to add environment variables
body: <p>I am a java script full stack developer.
  In the vue js I create two files in the root.</p>
  
  <ol>
  <li>env.development</li>
  <li>env.production</li>
  </ol>
  
  <p>In my <code>main.js</code> file, I can access environment variables like this</p>
  
  <pre><code>process.env.VUE_APP_MY_VARIABLE_X
  </code></pre>
  
  <p>How production and development differs in the vue js is,
  if I use <strong>npm run serve</strong> project loaded the development environment variables. If I use <strong>npm run build</strong> it takes production environment variables. That's all in vue.</p>
  
  <p>But in my <code>expressjs</code> project,</p>
  
  <pre><code>"start": "nodemon server.js --exec babel-node -e js",
  </code></pre>
  
  <p>This command will always responsible for the run project. I couldn't find two commands like in vue. I go though the tutorials every body says use the package called <strong>dotenv</strong>.</p>
  
  <p>I couldn't figure out that how could this package identify the environments this is production and this is development.</p>
  
  <p>End of the day I want to set my db password to 123456 in my local machine and root@123456 in the server. How could I achieve this?</p>