-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
31 lines (26 loc) · 855 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
require("dotenv").config();
require("./config/dbConfig");
const express = require("express");
const path = require("path");
const cookieParser = require("cookie-parser");
const logger = require("morgan");
const cors = require("cors");
const app = express();
//? Services like render use something called a proxy and you need to add this to your server
app.set("trust proxy", 1);
app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(
cors({
origin: [process.env.FRONTEND_URL],
credentials: true,
})
);
app.use("/api", require("./routes/index"));
app.use("/api/auth", require("./routes/auth"));
app.use("/api/partners", require("./routes/partners"));
app.use("/api/user", require("./routes/user"));
require("./error-handling/index")(app);
module.exports = app;