-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
31 lines (25 loc) · 841 Bytes
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import express from "express";
import cors from "cors";
import { createServer } from "http";
import { io } from "./src/services/socketIoService";
import studentRouter from "./src/routes/studentRouter";
import instrutorRouter from "./src/routes/intstructorRouter";
import adminRouter from "./src/routes/adminRouter";
import { errorHandler } from "./src/middlewares/errorHandler";
import cronJobSetup from "./src/services/cronJobSetup";
const app = express();
app.use(
cors({
methods: ["GET", "POST", "PUT", "DELETE", "PATCH"],
})
);
const httpServer = createServer(app);
io.attach(httpServer);
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use("/instructor", instrutorRouter);
app.use("/admin", adminRouter);
app.use(studentRouter);
app.use(errorHandler);
cronJobSetup();
export { httpServer };