Adding UI of FeedBack, Registration, Admin console

This commit is contained in:
2026-05-12 20:54:15 +07:00
parent 6a48d6351c
commit dd95ff5a21
30 changed files with 10038 additions and 36 deletions
+21
View File
@@ -0,0 +1,21 @@
import mongoose from "mongoose";
/** Cached connection for Next.js hot reload (global is preserved across HMR). */
const globalForMongoose = globalThis as typeof globalThis & {
mongooseConn?: typeof mongoose;
};
export default async function connectDB(): Promise<typeof mongoose> {
const uri = process.env.MONGODB_URI;
if (!uri) {
throw new Error("MONGODB_URI is not set. Add it to .env (e.g. mongodb://localhost:27017/ipv6_summit).");
}
if (globalForMongoose.mongooseConn?.connection?.readyState === 1) {
return globalForMongoose.mongooseConn;
}
const conn = await mongoose.connect(uri);
globalForMongoose.mongooseConn = conn;
return conn;
}