-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (24 loc) · 854 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
import express from "express";
import dotenv from "dotenv";
import cors from "cors";
import connectDB from "./database/db.js";
import authRouter from "./routes/authRoute.js";
import restaurantRouter from "./routes/restaurantRoute.js";
import contactRouter from "./routes/contactRoute.js";
import orderRouter from "./routes/orderRoute.js";
import webHookRouter from "./middleware/webHook.js";
dotenv.config();
const app = express();
const PORT = 8000;
connectDB(process.env.DB_USERNAME, process.env.DB_PASSWORD);
app.use(cors());
app.use(express.json());
app.use("/api/auth", authRouter);
app.use("/api/restaurant", restaurantRouter);
app.use("/api/contact", contactRouter);
app.use("/api/order", orderRouter);
app.use("/webhook", webHookRouter);
// Start the server
app.listen(PORT, () => {
console.log(`Server is running at port ${PORT}`);
});