KEMBAR78
Practical Part3 | PDF
0% found this document useful (0 votes)
8 views1 page

Practical Part3

This document provides instructions for connecting a Node.js application to a MongoDB Atlas database. It emphasizes the importance of using environment variables for security and configuration management. Users are guided to check their connection by running 'node server.js' and looking for the output 'Mongo connected' in the terminal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Practical Part3

This document provides instructions for connecting a Node.js application to a MongoDB Atlas database. It emphasizes the importance of using environment variables for security and configuration management. Users are guided to check their connection by running 'node server.js' and looking for the output 'Mongo connected' in the terminal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Connecting to the Mongo Atlas database – Part 3

Setup the following folders and files as shown

(Environment variables are key-value pairs that can affect how running processes will behave on a computer. They
are beneficial to keep specific configura ons separate from your applica on code, such as database connec ons or
external service creden als. Using environment variables ensures you can maintain security by not hardcoding
sensi ve informa on, allowing greater flexibility across different environments.) Visit website such as https://
jwtsecret.com/generate to obtain a strong Secret and also mongoDB to get the connection string

Lets check our nodejs app connection to the Mongol Atlas DB. You should see the
output “Mongo connected” in the terminal if your connection from your Nodejs App to
CloudAtlas MongoDB server is successful.
node server.js

You might also like