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

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

  app.useGlobalPipes(new ValidationPipe());

  await app.listen();
  console.log('Customer Microservice is listening on TCP port 8879');
}
bootstrap();
