import mongoose from "mongoose"; export const dbName = process.env.DB_NAME || "sm_db"; export const mongoURI = process.env.MONGODB_URI || "mongodb://127.0.0.1:27017"; // Connection documentation: https://mongoosejs.com/docs/connections.html try { mongoose.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true, dbName: dbName, }); } catch (error) { console.error(error); } export { mongoose };