text: const mongoose = require("mongoose");
  
  require("dotenv").config();
  const DB = process.env.DB;
  
  const connectDB = async () => {
    try {
      await mongoose.connect(DB, {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        useFindAndModify: false,
      });
      console.log("MongoDB connected");
    } catch (err) {
      console.log(err.message);
      process.exit(1);
    }
  };
  
  module.exports = connectDB;
  