diff --git a/backend/src/index.ts b/backend/src/index.ts index 849a250..01d7d19 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -5,31 +5,12 @@ import linkRoutes from "./routes/linkRoutes"; const app = new App([userRoutes, statusRoutes, linkRoutes]); -app.get("/corstest", (req: Request, res: Response) => { - res.json({ - status: "ok", - }); -}); - -app.use( - session({ - secret: PASSPORT_SECRET, - resave: false, - saveUninitialized: false, +app + .initializeDB() + .then(() => { + app.listen(); }) -); -const passportMiddleware = initializePassport(); -app.use(passportMiddleware.initialize()); - -passport.use(new LocalStrategy(UserModel.authenticate())); -passport.serializeUser(UserModel.serializeUser()); -passport.deserializeUser(UserModel.deserializeUser()); - -app.use("/", userRoutes); -app.use("/", statusRoutes); -app.use("/", linkRoutes); - -//Express-Server -app.listen(PORT, () => { - console.log(`Server is running on port ${PORT}`); -}); + .catch((error) => { + console.error("Failed to initialize the application:", error); + process.exit(1); + });