import { Logger as NestLogger } from '@nestjs/common' ; import { NestFactory } from '@nestjs/core' ; import { DocumentBuilder , SwaggerModule } from '@nestjs/swagger' ; import { AppModule } from './app.module' ; /**
 * https://docs.nestjs.com/recipes/swagger
 */ async function bootstrap ( ) { const app = await NestFactory . create ( AppModule ) ; const options = new DocumentBuilder ( ) . setTitle ( 'OpenAPI Documentation' ) . setDescription ( 'The sample API description' ) . setVersion ( '1.0' ) . addBearerAuth ( ) . build ( ) ; const document = SwaggerModule . createDocument ( app , options ) ; SwaggerModule . setup ( 'api' , app , document ) ; await app . listen ( process . env . PORT || 8000 ) ; return app . getUrl ( ) ; } ( async ( ) : Promise < void > => { try { const url = await bootstrap ( ) ; NestLogger . log ( url , 'Bootstrap' ) ; } catch ( error ) { NestLogger . error ( error , 'Bootstrap' ) ; } } ) ( ) ;