Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const mongoose = require("mongoose");
const URI = "URL"
const connectDB = async () => {
try {
await mongoose.connect(URI, {
useUnifiedTopology: true,
useNewUrlParser: true
})
console.log("MongoDB Connected")
} catch (err) {
console.log("MongoDB Authentication failed ")
}
}
module.exports = connectDB;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment