-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
34 lines (27 loc) · 765 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
import express from "express";
import cors from "cors";
import dotenv from "dotenv";
import { dbConnection } from "./database/dbConnection.js";
import { errorMiddleware } from "./error/error.js";
import reservationRouter from "./routes/reservationRoute.js";
const app = express();
dotenv.config({ path: "./config/config.env" });
app.use(
cors({
origin: [process.env.FRONTEND_URL],
methods: ["POST"],
credentials: true,
})
);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use("/api/v1/reservation", reservationRouter);
app.get("/", (req, res, next) => {
return res.status(200).json({
success: true,
message: "HELLO WORLD AGAIN",
});
});
dbConnection();
app.use(errorMiddleware);
export default app;