From f4bcf8b64da9e1df5a2a7252ca2666ea26301ef9 Mon Sep 17 00:00:00 2001 From: samuel Date: Mon, 26 Feb 2024 13:21:13 +0100 Subject: [PATCH] fix --- apps/policy-engine/src/main.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/policy-engine/src/main.ts b/apps/policy-engine/src/main.ts index f8de61ce9..d1b4433a1 100644 --- a/apps/policy-engine/src/main.ts +++ b/apps/policy-engine/src/main.ts @@ -38,6 +38,18 @@ const withGlobalPipes = (app: INestApplication): INestApplication => { return app } +const withJsonBodyParser = (app: INestApplication): INestApplication => { + app.use(json({ limit: '50mb' })) + + return app +} + +const withUrlEncoded = (app: INestApplication): INestApplication => { + app.use(urlencoded({ extended: true, limit: '50mb' })) + + return app +} + async function bootstrap() { const logger = new Logger('AuthorizationNodeBootstrap') const application = await NestFactory.create(AppModule) @@ -52,11 +64,8 @@ async function bootstrap() { of(application).pipe( map(withSwagger), map(withGlobalPipes), - map((app) => { - app.use(json({ limit: '50mb' })) - app.use(urlencoded({ extended: true, limit: '50mb' })) - return app - }), + map(withJsonBodyParser), + map(withUrlEncoded), switchMap((app) => app.listen(port)) ) )