DEV Community

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

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 ;)

sdutta099 profile image

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