oramap/backend/config/database.js
dvirlabs 02074aa4a6
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add MongoDB integration with CRUD UI
- Integrated MongoDB 7.0 with Mongoose ODM
- Added CRUD API endpoints (GET, POST, PUT, DELETE)
- Created Family model with validation
- Added database seeding script with initial data
- Implemented Add Family modal form in frontend
- Updated docker-compose with MongoDB service
- Updated Helm chart to v0.3.0 with MongoDB StatefulSet
- Updated documentation with MongoDB setup instructions
2026-03-25 01:51:46 +02:00

21 lines
543 B
JavaScript

const mongoose = require('mongoose');
const connectDB = async () => {
try {
const mongoURI = process.env.MONGODB_URI || 'mongodb://localhost:27017/oramap';
await mongoose.connect(mongoURI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
console.log('✅ MongoDB connected successfully');
console.log(`📍 Database: ${mongoose.connection.name}`);
} catch (error) {
console.error('❌ MongoDB connection error:', error.message);
process.exit(1);
}
};
module.exports = connectDB;