const mongoose = require('mongoose');
require('dotenv').config();

const conn = async () =>{
    try {
        await mongoose.connect(process.env.DB_CONN);
        console.log('MongoDB connected');
    } catch (error) {
        console.error('Error connecting to MongoDB:', error);
        process.exit(1);
    }
}

module.exports = conn;