-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (28 loc) · 925 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
35
36
37
38
39
40
41
const config = require("config");
const express = require("express");
const app = express();
const cors = require('cors')
app.use(cors());
const helmet = require("helmet");
app.use(helmet());
const compression = require("compression");
app.use(compression());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
const morgan = require("morgan");
app.use(morgan("tiny"));
const router = require("./router");
app.use("/", router);
app.get("/", (req, res) => {
res.status(200).send("OK");
});
const swaggerJSDoc = require("swagger-jsdoc");
const swaggerUi = require("swagger-ui-express");
const swaggerOptions = require("./swagger");
const swaggerSpec = swaggerJSDoc(swaggerOptions);
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec));
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(`HTTP server running on port ${port}`);
});
module.exports = app;