-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (29 loc) · 872 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
const express = require("express");
const morgan = require("morgan");
const helmet = require("helmet");
const path = require("node:path");
const swaggerJsDoc = require("swagger-jsdoc");
const swaggerUi = require("swagger-ui-express");
const swaggerJson = require("./docs/swagger.json");
// const restV1 = require("./v1/api");
// const restV2 = require("./v2/api");
const restV3 = require("./v3/api");
const port = 5500;
const app = express();
app.use(express.json());
app.use(express.static(path.resolve(__dirname, "public/")));
// log every query
app.use(morgan("dev"));
app.use(helmet());
// routers
// app.use("/v1", restV1);
// app.use("/v2", restV2);
app.use("/v3", restV3);
app.use(
"/api-docs",
swaggerUi.serve,
swaggerUi.setup(swaggerJson)
);
app.listen(port, "localhost", () => {
console.log(`Server is running on localhost:${port}`);
})