"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@nestjs/core");
const app_module_1 = require("./app.module");
const swagger_1 = require("@nestjs/swagger");
const common_1 = require("@nestjs/common");
const format_response_interceptor_1 = require("./interceptors/format-response.interceptor");
const custom_exception_filter_1 = require("./interceptors/custom-exception.filter");
const path_1 = require("path");
async function bootstrap() {
    const app = await core_1.NestFactory.create(app_module_1.AppModule, {});
    app.useGlobalPipes(new common_1.ValidationPipe({ transform: true }));
    const aasaPath = (0, path_1.join)(__dirname, '..', 'well-known', 'apple-app-site-association');
    app.getHttpAdapter().get('/.well-known/apple-app-site-association', (req, res) => {
        res.setHeader('Content-Type', 'application/json');
        res.sendFile(aasaPath);
    });
    const config = new swagger_1.DocumentBuilder()
        .setTitle('Your API Title')
        .setDescription('Your API Description')
        .setVersion('1.0')
        .addBearerAuth({ type: 'http', scheme: 'bearer', bearerFormat: 'JWT' }, 'Authorization')
        .build();
    const document = swagger_1.SwaggerModule.createDocument(app, config);
    swagger_1.SwaggerModule.setup('api', app, document);
    app.enableCors();
    app.useGlobalFilters(new custom_exception_filter_1.CustomExceptionFilter());
    app.useGlobalInterceptors(new format_response_interceptor_1.FormatResponseInterceptor());
    await app.listen(process.env.PORT ?? 3000, '0.0.0.0');
}
bootstrap();
//# sourceMappingURL=main.js.map