Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

why .env file in node.js is not working to connect mongodb

mongoose.connect(process.env.MONGO_URI).then(() => {
  console.log("DB Connected");
});

mongoose.connection.on("error", err => {
 console.log(`DB Connection Error: ${err.message}`);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #file #working #connect #mongodb
ADD COMMENT
Topic
Name
9+2 =