import { ClassSerializerInterceptor, ValidationPipe } from "@nestjs/common"; import { NestFactory, Reflector } from "@nestjs/core"; import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"; import { AppModule } from "./app.module"; async function bootstrap() { const app = await NestFactory.create(AppModule); app.enableCors({ origin: "*", }); app.useGlobalPipes(new ValidationPipe()); app.useGlobalInterceptors( new ClassSerializerInterceptor(app.get(Reflector), { excludeExtraneousValues: true, }), ); const config = new DocumentBuilder() .setTitle("Toogether API") .addBearerAuth() .build(); const documentFactory = () => SwaggerModule.createDocument(app, config); SwaggerModule.setup("documentation", app, documentFactory, { swaggerOptions: { tryItOutEnabled: true, persistAuthorization: true, }, }); await app.listen(process.env.PORT ?? 3000, "0.0.0.0"); } bootstrap();