Created
August 18, 2020 19:33
-
-
Save lakshaygupta21/59ed7421c1da6a1cf0d8af138d91d535 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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