import { MongoClient } from 'mongodb' import mongoose from 'mongoose' export default class Client { private static connectionString = import.meta.env.MONGODB private static client = false public static async get() { if (!this.connectionString) { throw new Error('Can\'t connect to the database, missing the connection string') } if (!this.client) { console.log(this.connectionString) mongoose.connect(this.connectionString) this.client = true } return this.client } }