-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (31 loc) · 955 Bytes
/
index.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 Connect from "./mongo/Connect.js";
import express from "express";
import * as dotenv from "dotenv";
import cors from "cors";
import userRoute from "./routes/userRoutes.js"
import authRoute from "./routes/authRoute.js"
import productRoute from "./routes/productRoutes.js"
import cartRoute from "./routes/cartRoutes.js"
import orderRoute from "./routes/orderRoutes.js"
dotenv.config();
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(cors());
app.use(express.json({ limit: "50mb" }));
app.use("/api/v1/auth",authRoute)
app.use("/api/v1/users", userRoute);
app.use("/api/v1/products",productRoute)
app.use("/api/v1/cart",cartRoute)
app.use("/api/v1/orders",orderRoute)
app.use("/api/v1/stripe",orderRoute)
const startServer = async () => {
try {
Connect(process.env.MONGO_URL);
app.listen(5000, () => {
console.log("we up");
});
} catch (error) {
console.log(error);
}
};
startServer();