Express.js: Environment variables
Environment variables will be injected when Node server starts, that allows us to use different values for development and production. Typicall we use this for login, passwords, etc…
app.js
With nodemon
we can provide configuration file nodemon.json
.
nodemon.json
But in production we will not use nodemon
because we will be not restarting server after every change and also we will not be doing any changes in production. So we can update package.json
file.
package.json
We can then start our app locally with npm run start:dev
.