From f8cd47e9407489acbb90c2b9491b1b8a508ca27c Mon Sep 17 00:00:00 2001 From: faris Aljohari <83524184+farisaljohari@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:51:02 +0300 Subject: [PATCH] increase body limit --- src/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 0253ad0..d9291bd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import rateLimit from 'express-rate-limit'; import helmet from 'helmet'; import { setupSwaggerAuthentication } from '../libs/common/src/util/user-auth.swagger.utils'; import { ValidationPipe } from '@nestjs/common'; +import { json, urlencoded } from 'body-parser'; import { SeederService } from '@app/common/seed/services/seeder.service'; async function bootstrap() { @@ -11,6 +12,10 @@ async function bootstrap() { app.enableCors(); + // Set the body parser limit to 1 MB + app.use(json({ limit: '1mb' })); + app.use(urlencoded({ limit: '1mb', extended: true })); + app.use( rateLimit({ windowMs: 5 * 60 * 1000, @@ -42,7 +47,8 @@ async function bootstrap() { } catch (error) { console.error('Seeding failed!', error); } + + console.log('Starting auth at port ...', process.env.PORT || 4000); await app.listen(process.env.PORT || 4000); } -console.log('Starting auth at port ...', process.env.PORT || 4000); bootstrap();