db.js 419 Bytes
import mongoose from "mongoose";

mongoose.connect("mongodb://127.0.0.1:27017/dev-profile",{
    useNewUrlParser: true,
    useFindAndModify: false,
    useUnifiedTopology: true
    }
);

const db = mongoose.connection;
const handleOpen = () =>console.log("✅ Connected to DB");
const handleError = (error) =>console.log(`❌ Error on DB Connection:${error}`);


db.once("open", handleOpen);
db.on("eror",handleError);