Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshaygupta21/59ed7421c1da6a1cf0d8af138d91d535 to your computer and use it in GitHub Desktop.
Save lakshaygupta21/59ed7421c1da6a1cf0d8af138d91d535 to your computer and use it in GitHub Desktop.
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