import { connect } from "mongoose";

async function connectDB() {
  try {
    await connect(process.env.MONGO_URI!, { dbName: "estate" });
    console.log("MongoDB connected...");
  } catch (error) {
    if (error instanceof Error) {
      console.error(error.message);
    }

    process.exit(1);
  }
}

export default connectDB;
