This video is available to students only

Use Environment Variables With Node.js and MongoDB

Defining and using environment-specific configuration variables within code files is less than ideal due to security reasons as well as the coupling of environment-specific configuration and application code. In this lesson, we'll avoid declaring our MongoDB environment variables directly in our database connection file and instead use the popular dotenv package to load environment variables from a .env file.

Start a new discussion. All notification go to the author.

Chat with your educational course! Ask any question about course material.