11import compression from 'compression'
2+ import cookieParser from 'cookie-parser'
23import cors from 'cors'
34import express , { Application , Request , Response } from 'express'
45import userAgent from 'express-useragent'
56import helmet from 'helmet'
7+ import hpp from 'hpp'
68import path from 'path'
79import requestIp from 'request-ip'
810import expressErrorHandle from '~/app/middleware/error-handle'
11+ import expressErrorTypeorm from '~/app/middleware/error-typeorm'
912import expressErrorValidation from '~/app/middleware/error-validation'
1013import expressRateLimit from '~/app/middleware/rate-limit'
1114import expressUserAgent from '~/app/middleware/user-agent'
@@ -31,8 +34,10 @@ export class App {
3134 this . _app . use ( express . urlencoded ( { extended : true } ) )
3235 this . _app . use ( express . static ( path . resolve ( `${ __dirname } /public` ) ) )
3336 this . _app . use ( compression ( ) )
37+ this . _app . use ( cookieParser ( ) )
3438 this . _app . use ( helmet ( ) )
3539 this . _app . use ( cors ( { origin : allowedCors } ) )
40+ this . _app . use ( hpp ( ) )
3641 this . _app . use ( requestIp . mw ( ) )
3742 this . _app . use ( userAgent . express ( ) )
3843
@@ -62,6 +67,9 @@ export class App {
6267 // @ts -expect-error
6368 this . _app . use ( expressErrorValidation )
6469
70+ // @ts -expect-error
71+ this . _app . use ( expressErrorTypeorm )
72+
6573 // @ts -expect-error
6674 this . _app . use ( expressErrorHandle )
6775
0 commit comments