diff --git a/server/middleware/00.dbconn.ts b/server/middleware/00.dbconn.ts new file mode 100644 index 0000000..8f498cd --- /dev/null +++ b/server/middleware/00.dbconn.ts @@ -0,0 +1,19 @@ +import mongoose from "mongoose" +import {Ficmas} from "~/models/challenges/ficmas" +import {Challenge} from "~/models/challenges/gen" +import {Biffno} from "~/models/challenges/biffno" + +export default eventHandler(async (event) => { + let beep = useRuntimeConfig() + console.log(beep) + Challenge; + Biffno; + Ficmas; + try { + console.log("connecting........") + await mongoose.connect(beep.database.uri) + } catch(e) { + console.error(e) + throw createError({statusCode: 500, message: "whoops."}) + } +}) \ No newline at end of file