import dotenv from 'dotenv'
import mongoose from 'mongoose'
dotenv.config()

async function connectToDb() {
    try {
        await mongoose.connect(process.env.MONGO_URL).then(()=>
        console.log("Connected To Database")).catch((err)=>console.log("Error in connecting db",err.message))
    } catch (error) {
        console.error('Error connecting to MongoDB:', error)
    }
}
export default connectToDb