-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
35 lines (26 loc) · 891 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
31
32
33
34
35
import express from 'express'
import cookieParser from 'cookie-parser';
import userRouter from './routes/user.js'
import productRouter from './routes/product.js'
import orderRouter from './routes/order.js'
import fileUpload from 'express-fileupload';
import cors from 'cors'
//creating app, will listen this server inside server.js
export const app = express();
//----> using middlewares
//use this to read the json data that we'll be sending while making POST, PUT requests
app.use(express.json());
app.use(express.urlencoded({extended:true}));
app.use(cookieParser());
app.use(fileUpload({
limits: {fileSize: 50 * 1024 * 1024},
useTempFiles: true
}))
app.use(cors());
//---> using routes
app.use('/api/v1/user', userRouter);
app.use('/api/v1/product', productRouter);
app.use('/api/v1/order', orderRouter);
app.get('/',(req,res)=>{
res.send("Welcome to QuickPick")
})