import { ValidationPipe, VersioningType } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { AppModule } from './app.module'; export async function createApp() { const app = await NestFactory.create(AppModule, { bufferLogs: true }); app.setGlobalPrefix('api'); app.enableVersioning({ type: VersioningType.URI, }); app.useGlobalPipes( new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true, }), ); const document = SwaggerModule.createDocument( app, new DocumentBuilder() .setTitle('Velody API') .setDescription('Velody Phase 1 foundation API') .setVersion('1.0.0') .build(), ); SwaggerModule.setup('api/docs', app, document, { jsonDocumentUrl: 'api/docs-json', }); return app; }