-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (22 loc) · 822 Bytes
/
app.js
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
import express from 'express';
import cors from 'cors';
import cookieParser from "cookie-parser";
import postRouter from './routes/postRoute.js';
import authRouter from './routes/authRoute.js';
import testRouter from './routes/testRoute.js';
import userRouter from './routes/userRoute.js';
import chatRouter from './routes/chatRoute.js';
import msgRouter from './routes/msgRoute.js';
const app = express();
app.use(cors({origin: process.env.CLIENT_URL, credentials: true}));
app.use(express.json());
app.use(cookieParser());
app.use("/api/posts", postRouter);
app.use("/api/auth", authRouter);
app.use("/api/users", userRouter);
app.use("/api/chats", chatRouter);
app.use("/api/messages", msgRouter);
app.use("/api/test", testRouter);
app.listen(8800, () => {
console.log('Server is running on port 8800');
});