import { ValidationPipe } from '@nestjs/common' ; import { NestFactory } from '@nestjs/core' ; import { DocumentBuilder , SwaggerModule } from '@nestjs/swagger' ; import { AppModule } from './app/app.module' ; async function bootstrap ( ) { const app = await NestFactory . create ( AppModule , { cors : true } ) ; const globalPrefix = 'api' ; app . setGlobalPrefix ( globalPrefix ) ; app . useGlobalPipes ( new ValidationPipe ( { transform : true , transformOptions : { enableImplicitConversion : true } } ) ) ; const port = process . env . port || 3333 ; const options = new DocumentBuilder ( ) . setTitle ( 'Pimp My Pr' ) . setDescription ( 'API for pull request statistics tool' ) . addBearerAuth ( ) . build ( ) ; const document = SwaggerModule . createDocument ( app , options ) ; SwaggerModule . setup ( 'api' , app , document ) ; await app . listen ( port , ( ) => { console . log ( 'Listening at http://localhost:' + port + '/' + globalPrefix ) ; } ) ; } bootstrap ( ) ;