MongoDB connection
Unanswered
Ragdoll posted this in #help-forum
RagdollOP
import mongoose, { ConnectOptions } from "mongoose";
const uri: string = process.env.MONGODB_URI!;
async function connect() {
await mongoose.connect(uri, {
useUnifiedTopology: true,
useNewUrlParser: true,
socketTimeoutMS: 300000,
} as ConnectOptions);
}
connect();should I export the connect function and call it inside main page.tsx ? so the connection should be established .