-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.ts
More file actions
27 lines (22 loc) · 783 Bytes
/
app.ts
File metadata and controls
27 lines (22 loc) · 783 Bytes
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
import * as bodyParser from "body-parser";
import * as express from "express";
import * as helmet from "helmet";
import * as swaggerUi from "swagger-ui-express";
import * as swaggerDocument from "./../swagger.json";
import { fiddleRoutes } from "./routes/fiddleRoutes";
import { healthCheckRoutes } from "./routes/healthCheckRoutes";
class App {
public app: express.Application;
constructor() {
this.app = express();
this.config();
}
private config(): void {
this.app.use(helmet());
this.app.use(bodyParser.json()); // parse json from request body
this.app.use("/health", healthCheckRoutes);
this.app.use("/fiddles", fiddleRoutes);
this.app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));
}
}
export default new App().app;