// @ts-check
const mongoose = require('mongoose');
const { env } = require('../config/env');

export async function connectDB() {
  if (mongoose.connection.readyState === 1) return;
  mongoose.set('strictQuery', true);
  await mongoose.connect(env.MONGO_URI);
  console.log('[mongo] connected');
}
