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

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

  app.useGlobalPipes(new ValidationPipe());

  await app.listen();
  console.log('Shop Microservice is listening on TCP port 8881');
}

bootstrap();
