-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
32 lines (24 loc) · 825 Bytes
/
app.js
File metadata and controls
32 lines (24 loc) · 825 Bytes
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
32
import express from "express";
import cors from "cors";
import { createServer } from "http";
import { io } from "./src/utils/SocketIo.js";
import studentRoute from "./src/routes/StudentRouter.js";
import adminRoute from "./src/routes/AdminRouter.js";
import instructorRoute from "./src/routes/InstructorRouter.js";
const app = express();
app.use(
cors({
origin: "http://localhost:5173",
// origin: "https://mastery-link-client.vercel.app",
methods: ["GET", "POST", "PUT", "PATCH"],
credentials: true,
})
);
const httpServer = createServer(app);
io.attach(httpServer);
app.use(express.json({ limit: "50mb" }));
app.use(express.urlencoded({ limit: "50mb", extended: true }));
app.use("/", studentRoute);
app.use("/admin", adminRoute);
app.use("/instructor", instructorRoute);
export { httpServer };