import { BadRequestException , ClassSerializerInterceptor , ValidationPipe } from "@nestjs/common" ; import { Reflector } from "@nestjs/core" ; import { NestFactory } from "@nestjs/core" ; import { AppModule } from "./app.module" ; import { BadRequestExceptionFilter } from "./common/bad-request-exception.filter" ; import { DEBUG } from "./common/constants" ; import * as bodyParser from "body-parser" ; async function bootstrap ( ) { const app = await NestFactory . create ( AppModule , { logger : DEBUG ? [ "debug" , "verbose" , "log" , "warn" , "error" ] : [ "log" , "warn" , "error" ] } ) ; app . useGlobalPipes ( new ValidationPipe ( { exceptionFactory : errors => new BadRequestException ( errors ) , transform : true , whitelist : true , forbidNonWhitelisted : true } ) ) ; app . useGlobalInterceptors ( new ClassSerializerInterceptor ( app . get ( Reflector ) ) ) ; app . useGlobalFilters ( new BadRequestExceptionFilter ( ) ) ; app . use ( bodyParser . json ( { limit : "25mb" } ) ) ; app . use ( bodyParser . urlencoded ( { limit : "25mb" , extended : true } ) ) ; const server = await app . listen ( 3005 ) ; server . keepAliveTimeout = 65000 ; server . headersTimeout = 66000 ; } bootstrap ( ) ;