forked from 13somesh/MealMatters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve issue #8 : Added test for Auth routes
- Loading branch information
1 parent
cd15768
commit 8226234
Showing
5 changed files
with
276 additions
and
132 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const mongoose = require("mongoose"); | ||
|
||
const dbConnect = async (callback) => { | ||
try { | ||
mongoose.set('strictQuery', false) | ||
const connect = await mongoose.connect(process.env.MONGO_URL); | ||
if (connect) { | ||
console.log("DB is successfully connected"); | ||
callback(); //start the server | ||
} | ||
} catch (error) { | ||
console.error("Error connecting to the database:", error); | ||
try { | ||
mongoose.set("strictQuery", false); | ||
const connect = await mongoose.connect(process.env.MONGO_URL); | ||
if (connect) { | ||
console.log("DB is successfully connected"); | ||
callback(); //start the server | ||
} | ||
} | ||
} catch (error) { | ||
console.error("Error connecting to the database:", error); | ||
} | ||
}; | ||
|
||
module.exports = dbConnect; | ||
module.exports = dbConnect; |
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
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
Oops, something went wrong.