-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (27 loc) · 850 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
const express = require("express");
const cors = require("cors");
const { connection } = require("./config/db");
const { userRouter } = require("./Routes/User.Route");
const { productRoute } = require("./Routes/Product.Route");
const { cartRoute } = require("./Routes/Cart.Route");
const { wishlistRoute } = require("./Routes/Wishlist.Route");
const app = express();
app.use(express.json());
app.use(cors());
app.get("/", (req, res) => {
res.send("Home Page");
});
app.use("/users", userRouter);
app.use("/products", productRoute);
app.use("/carts", cartRoute);
app.use("/wishlist", wishlistRoute)
app.listen(4500, async () => {
try {
await connection;
console.log("Connected to DB");
} catch (error) {
console.log(" Cannot Connected to DB");
console.log(error);
}
console.log("Running the server at port 4500");
});