DEV Community

Discussion on: How to connect to MongoDB Atlas using Node.js

Collapse
dalalrohit profile image
Rohit Dalal Author

you can pass the credentials via environment variables and make sure you don't push that to git. something like is used in production

const url="..<process.env.USERNAME>&<process.env.PASSWORD>";
Enter fullscreen mode Exit fullscreen mode

added this just for demo purpose ;)

Collapse
sdutta099 profile image
sdutta099

thanks a lot for the reply yes i tried using above step only