Many services, servers use environment variables for configuration purposes. Its a good way to keep private configuration settings outside of your repo.
However setting env variables can be a pain, as every time you restart your computer the variables needs to be set again.
One way to resolve this is to use .env files.
To install the .env package simply run:
npm i dotenv --save
And to use the package in your application add require('dotenv').config(); to your entry file as early as possible. Your entry file in a Node app is normally app.js at the root of your project.
Set variables in your .env as follow:
MY_ENV_VARIABLE=the-value-to-be-used
Now to have access to the variable in your application simply use:
process.env.MY_ENV_VARIABLE
That's it!