Added backend folder in Bhakti's branch for Salvi to make changes.

This commit is contained in:
K
2025-02-23 09:15:03 +05:30
parent 7dd344f722
commit a551e075b7
28 changed files with 7028 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
const mongoose = require("mongoose");
const catchAsyncErrors = require("../Middlewares/catchAsyncErrors.js");
const DB_connect = catchAsyncErrors(async () => {
try {
const connectionInstance = await mongoose.connect(
`${process.env.MONGODB_URI}/${process.env.DATABASE_NAME}`
);
if (!connectionInstance) {
console.log("MongoDB connection failed");
}
console.log(
"MongoDB connected Successfully on server : " +
connectionInstance.connection.host
);
} catch (error) {
console.log("MongoDB connection failed due to some error :", error);
}
});
module.exports = DB_connect;