Create a CRUD App with Node and MongoDB

Environment Variables

We'll be using a handy package called dotenv to bring all environment variables in a .env file into our project.

Once we configure the package using:

require('dotenv').config();

We are able to call any variables from the environment using:

process.env.<variable_name>

process.env.DB_URI

It's common practice to keep environment variable names fully uppercase.

Note: Be sure to add .env to your .gitignore so that it doesn't get committed to your repo. Keep secret info out of public repos!