Skip to content

Commit 9fc1364

Browse files
Pre-Release Enhancements Done :)
Pre-Release Enhancements
2 parents 2a5a552 + 1339ba2 commit 9fc1364

File tree

18 files changed

+553
-206
lines changed

18 files changed

+553
-206
lines changed

β€ŽBackend/db/serverdb.jsβ€Ž

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ const { DB_NAME } = require("./constants.js");
33

44
const connectDB = async () => {
55
try {
6-
const connectionInstance = await mongoose.connect(`${process.env.MONGODB_URI}/${DB_NAME}`);
6+
if (!process.env.MONGODB_URI) {
7+
throw new Error("MONGODB_URI is not defined in environment variables");
8+
}
9+
10+
const connectionInstance = await mongoose.connect(`${process.env.MONGODB_URI}/${DB_NAME}`, {
11+
useNewUrlParser: true,
12+
useUnifiedTopology: true,
13+
});
14+
715
console.log(`\n MongoDB connected !! DB HOST: ${connectionInstance.connection.host}`);
816
} catch (error) {
9-
console.log("MONGODB connection FAILED ", error);
17+
console.error("MONGODB connection FAILED", error);
1018
process.exit(1);
1119
}
1220
};
44.7 KB
Loading
87.5 KB
Loading
Lines changed: 15 additions & 0 deletions
Loading
Lines changed: 21 additions & 0 deletions
Loading

β€Žsrc/assets/SVGs/rocket.svgβ€Ž

Lines changed: 52 additions & 0 deletions
Loading

0 commit comments

Comments
Β (0)