Amirm8950
MERN Inventory: working backend + frontend
8b8b6f5
raw
history blame contribute delete
295 Bytes
import mongoose from "mongoose";
export const connectDB = async () => {
try {
await mongoose.connect(process.env.MONGODB_URI);
console.log("✅ MongoDB connected");
} catch (err) {
console.error("❌ MongoDB connection error:", err?.message || err);
process.exit(1);
}
};