added to routes for the user auth
All checks were successful
gitea/MERN_STACK_TEMPLATE/pipeline/head This commit looks good
All checks were successful
gitea/MERN_STACK_TEMPLATE/pipeline/head This commit looks good
This commit is contained in:
11
backend/db/connectDB.js
Normal file
11
backend/db/connectDB.js
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user