added to routes for the user auth
All checks were successful
gitea/MERN_STACK_TEMPLATE/pipeline/head This commit looks good

This commit is contained in:
2025-05-02 13:24:52 +02:00
parent a781c563d0
commit 7333cf79bd
7 changed files with 43 additions and 1 deletions

11
backend/db/connectDB.js Normal file
View File

@ -0,0 +1,11 @@
import mongoose from "mongoose";
export const connectDB = async () => {
try {
const conn = await mongoose.connect(process.env.MONGO_URI);
console.log(`MongoDB Connected: ${conn.connection.host}`);
} catch(error) {
console.log("Error connection to MongoDB: ", error.message);
process.exit(1);
}
}