-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (25 loc) · 785 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
30
import express from 'express';
import cookieParser from 'cookie-parser';
import passport from './config/passport.js';
import authRouter from './routes/authRoutes.js';
import cors from 'cors';
import dotenv from 'dotenv';
import connectDB from './config/database.js';
import productRouter from './routes/productRoutes.js';
import cartRouter from './routes/cartRoutes.js';
import userRouter from './routes/userRoutes.js';
dotenv.config();
connectDB();
const app = express();
app.use(cors({
origin: 'https://localhost:5173',
credentials: true,
}));
app.use(express.json());
app.use(cookieParser());
app.use(passport.initialize());
app.use("/api/v1", productRouter);
app.use("/api/v1", cartRouter);
app.use("/api/v1", userRouter);
app.use("",authRouter);
export default app;