import { NestFactory } from '@nestjs/core'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { join } from 'path'; import { AppModule } from './app.module'; import { HEALTH_SERVICE_NAME, SERVICE_NAME } from './app.constants'; async function bootstrap() { const app = await NestFactory.create(AppModule); app.connectMicroservice({ transport: Transport.TCP, }); app.connectMicroservice({ transport: Transport.GRPC, options: { package: [SERVICE_NAME, HEALTH_SERVICE_NAME], protoPath: [ join(__dirname, 'modules/ad/interface/grpc-controllers/ad.proto'), join(__dirname, 'health.proto'), ], url: `${process.env.SERVICE_URL}:${process.env.SERVICE_PORT}`, loader: { keepCase: true, enums: String }, }, }); await app.startAllMicroservices(); await app.listen(process.env.HEALTH_SERVICE_PORT as unknown as number); } bootstrap();