-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.ts
35 lines (28 loc) · 964 Bytes
/
App.ts
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
const express = require('express');
const bodyParser = require('body-parser');
import { Routes } from './routes/post.routes';
export class App {
private express;
private router:Routes;
constructor() {
this.router = new Routes();
this.express = express();
this.middleware();
this.routes();
}
// Config Express middleware.
private middleware(): void {
this.express.use(bodyParser.json({limit: "50mb"}));
this.express.use(bodyParser.urlencoded({limit: "50mb", extended: true, parameterLimit:50000}));
this.express.use(bodyParser.json({ type: 'application/vnd.api+json' }));
this.express.use(bodyParser.urlencoded({ extended: false }));
}
// Init Routes.
private routes(): void {
this.router.init(express);
this.express.use('/api/', this.router.getRoutes());
}
public getExpress: () => any = () => {
return this.express;
}
}