-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (28 loc) · 762 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
35
36
37
const express = require("express");
const cors = require("cors");
const cookieParser = require("cookie-parser");
const { BASE_URL, DEBUG } = require("./config/index.js");
const swaggerUi = require("swagger-ui-express");
const YAML = require("yamljs");
const app = express();
app.use(express.json({ limit: "20mb", extended: true }));
app.use(express.urlencoded({ limit: "20mb", extended: true }));
app.use(
cors({
origin: BASE_URL,
credentials: true,
})
);
app.use(cookieParser());
var options = {
explorer: true,
};
if (DEBUG) {
const swaggerDocument = YAML.load("./swagger.yaml");
app.use(
"/api-docs",
swaggerUi.serve,
swaggerUi.setup(swaggerDocument, options)
);
}
module.exports = app;