Make connection to db non-async
This commit is contained in:
@ -11,9 +11,9 @@ if (!url) {
|
|||||||
throw new Error('MONGODB_URI is not defined in the .env file.');
|
throw new Error('MONGODB_URI is not defined in the .env file.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const dbconnect = async () =>{
|
const dbconnect = () => {
|
||||||
mongoose.connect(url)
|
mongoose.connect(url)
|
||||||
.then(() =>{
|
.then(() => {
|
||||||
console.log('Connected to MongoDB');
|
console.log('Connected to MongoDB');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
Reference in New Issue
Block a user