MCPcopy Create free account
hub / github.com/CodeWithHarry/Sigma-Web-Dev-Course / connectDb

Function connectDb

Video 131/db/connectDb.js:4–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import mongoose from "mongoose";
3
4const connectDb = async () => {
5 try {
6 const conn = await mongoose.connect(process.env.MONGO_URI, {
7 useNewUrlParser: true,
8 });
9 console.log(`MongoDB Connected: ${conn.connection.host}`);
10 return conn;
11
12 } catch (error) {
13 console.error(error.message);
14 process.exit(1);
15 }
16 }
17
18 export default connectDb;

Callers 7

initiateFunction · 0.85
fetchuserFunction · 0.85
fetchpaymentsFunction · 0.85
updateProfileFunction · 0.85
signInFunction · 0.85
POSTFunction · 0.85
checkUserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected