import { NestFactory } from '@nestjs/core' ; import { Logger , ValidationPipe } from '@nestjs/common' ; import { HttpResponseInterceptor , HttpExceptionFilter } from '@common/http' ; import * as compression from 'compression' ; import { AppModule } from './app.module' ; import { SwaggerConfig } from '@config' ; import * as helmet from 'helmet' ; const bootstrap = async ( ) => { const app = await NestFactory . create ( AppModule ) ; app . use ( helmet ( ) ) ; app . use ( compression ( ) ) ; app . enableCors ( ) ; app . enableVersioning ( ) ; app . useGlobalFilters ( new HttpExceptionFilter ( ) ) ; app . useGlobalInterceptors ( new HttpResponseInterceptor ( ) ) ; app . useGlobalPipes ( new ValidationPipe ( ) ) ; app . setGlobalPrefix ( AppModule . apiPrefix ) ; SwaggerConfig ( app , AppModule . apiVersion ) ; await app . listen ( AppModule . port ) ; return AppModule . port ; } ; bootstrap ( ) . then ( ( port ) => { Logger . log ( `Application running on port: ${ port }` , 'Main' ) ; } ) ;