diff --git a/src/main.ts b/src/main.ts index ca1f187..1968aa9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,11 +13,7 @@ import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; async function bootstrap() { const app = await NestFactory.create(AppModule); - app.enableCors({ - origin: [process.env.FRONTEND_URL], // solo frontend permitido - methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', - credentials: true, - }); + app.enableCors({ exposedHeaders: ['Content-Disposition'] }); app.useGlobalPipes( new ValidationPipe({ @@ -25,30 +21,30 @@ async function bootstrap() { }), ); - // app.useGlobalFilters(new GlobalExceptionFilter()); + app.useGlobalFilters(new GlobalExceptionFilter()); - // const config = new DocumentBuilder() - // .setTitle('Documentacion de la api de carga masiva de CEDETEC') - // .setDescription( - // 'El objetivo es mejorar la gestion interna y la integridad de los datos', - // ) - // .setVersion('1.0') - // .addBearerAuth( - // { - // type: 'http', - // scheme: 'bearer', - // bearerFormat: 'JWT', - // name: 'Authorization', - // in: 'header', - // }, - // 'bearer', // nombre del security definition - // ) - // .build(); - // // .addServer(process.env.SWAGGER_SERVER_URL) // descomentar parael servidor de acatlan + const config = new DocumentBuilder() + .setTitle('Documentacion de la api de carga masiva de CEDETEC') + .setDescription( + 'El objetivo es mejorar la gestion interna y la integridad de los datos', + ) + .setVersion('1.0') + .addBearerAuth( + { + type: 'http', + scheme: 'bearer', + bearerFormat: 'JWT', + name: 'Authorization', + in: 'header', + }, + 'bearer', // nombre del security definition + ) + .build(); + // .addServer(process.env.SWAGGER_SERVER_URL) // descomentar parael servidor de acatlan - // const document = SwaggerModule.createDocument(app, config); + const document = SwaggerModule.createDocument(app, config); - // SwaggerModule.setup('documentation', app, document); + SwaggerModule.setup('documentation', app, document); const port = process.env.API_PORT || 4000; await app.listen(port, '0.0.0.0'); @@ -64,9 +60,9 @@ async function bootstrap() { `\x1b[36m=========================================================\x1b[0m`, ); console.log(`\x1b[32m✅ API corriendo en:\x1b[0m http://localhost:${port}`); - // console.log( - // `\x1b[32m✅ Documentación disponible en:\x1b[0m http://localhost:${port}/documentation`, - // ); + console.log( + `\x1b[32m✅ Documentación disponible en:\x1b[0m http://localhost:${port}/documentation`, + ); console.log( `\x1b[36m=========================================================\x1b[0m\n`,