-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
28 lines (24 loc) · 871 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
const express = require("express");
const app = express();
const cookiParser = require("cookie-parser");
const bodyparser = require("body-parser");
const fileUpload = require("express-fileupload");
const path = require("path");
app.use(express.json());
app.use(cookiParser());
app.use(bodyparser.urlencoded({ extended: true }));
app.use(fileUpload());
// Route Import
const product = require("./routes/productRouter");
const user = require("./routes/userRouter");
const order = require("./routes/orderRouter");
const payment = require("./routes/paymentRoute");
app.use("/api/v1", user);
app.use("/api/v1/", product);
app.use("/api/v1", order);
app.use("/api/v1", payment);
app.use(express.static(path.join(__dirname, "./frontend/build")));
app.get("*", (req, res) => {
res.sendFile(path.resolve(__dirname, "./frontend/build/index.html"));
});
module.exports = app;