import { Logger } from '@nestjs/common' import { ConfigService } from '@nestjs/config' import { NestFactory } from '@nestjs/core' import { SwaggerModule } from '@nestjs/swagger' import { AppModule } from './core/app.module' import { getCorsConfig, swaggerConfig, validationPipe } from './core/config' async function bootstrap() { const app = await NestFactory.create(AppModule) const logger = new Logger() const config = app.get(ConfigService) app.useGlobalPipes(validationPipe) app.enableCors(getCorsConfig(config)) const swaggerDocument = SwaggerModule.createDocument(app, swaggerConfig) SwaggerModule.setup('docs', app, swaggerDocument, { yamlDocumentUrl: '/docs/openapi.yaml' }) const port = config.getOrThrow('HTTP_PORT') const host = config.getOrThrow('HTTP_HOST') await app.listen(port) logger.log(`Gateway started: ${host}`) logger.log(`Healthcheck: ${host}health`) logger.log(`Swagger: ${host}docs`) } bootstrap()