MCPcopy Index your code
hub / github.com/100devs/binary-upload-boom / connectDB

Function connectDB

config/database.js:3–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1const mongoose = require("mongoose");
2
3const connectDB = async () => {
4 try {
5 const conn = await mongoose.connect(process.env.DB_STRING, {
6 useNewUrlParser: true,
7 useUnifiedTopology: true,
8 useFindAndModify: false,
9 useCreateIndex: true,
10 });
11
12 console.log(`MongoDB Connected: ${conn.connection.host}`);
13 } catch (err) {
14 console.error(err);
15 process.exit(1);
16 }
17};
18
19module.exports = connectDB;

Callers 1

server.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected