import { NestFactory } from '@nestjs/core';
import { MerchantModule } from './merchant.module';
import { ValidationPipe } from '@nestjs/common';
import { MicroserviceOptions, Transport } from '@nestjs/microservices';

async function bootstrap() {
  const app = await NestFactory.createMicroservice<MicroserviceOptions>(
    MerchantModule,
    {
      transport: Transport.TCP,
      options: {
        host: '0.0.0.0',
        port: 8878,
      },
    },
  );

  app.useGlobalPipes(new ValidationPipe());

  await app.listen(); // ✅ Only TCP listener
  console.log('Merchant Microservice is listening on TCP port 8878');

}
bootstrap();
