Commit
This commit is contained in:
commit
d1c8cae2c1
1417 changed files with 326736 additions and 0 deletions
16
configs/mongo.js
Normal file
16
configs/mongo.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
const mongoose = require('mongoose')
|
||||
|
||||
const connectDB = async () => {
|
||||
try{
|
||||
const conn = await mongoose.connect(process.env.MONGO_URI,{
|
||||
useNewUrlParser: true
|
||||
})
|
||||
console.log(`MongoDB is connected : ${conn.connection.host}`)
|
||||
}
|
||||
catch (err){
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = connectDB
|
||||
Loading…
Add table
Add a link
Reference in a new issue