import mongoose from "mongoose";

const dbUrl = 'mongodb://127.0.0.1:27017/z12_base';

async function connectDB() {
  try {
    await mongoose.connect(dbUrl, {
      useNewUrlParser: true,
      useUnifiedTopology: true
    });

    console.log("Połączono z MongoDB (Mongoose)");
  } catch (err) {
    console.error("Błąd połączenia z MongoDB:", err.message);
  }
}

export default connectDB;