You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
310 B
JavaScript

import mongoose from "mongoose";
const connectDB = async () => {
try {
await mongoose.connect(process.env.MONGO_URI)
console.log(`Sucessfully connected to mongoDB`)
} catch(error){
console.log(`ERROR: ${error.message}`)
process.exit(1)
}
}
export default connectDB