Rayder-_-
Rayder-_-

Reputation: 219

How to create MQTT broker in NestJS 8

I'm trying to create an MQTT broker in NestJS, so I'm following the official doc here. However I have the impression that this doc is not up to date anymore because with Nest version 8 MicroserviceOptions doesn't exist so I don't know by what to replace it.

const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, {
  transport: Transport.MQTT,
  options: {
    url: 'mqtt://localhost:1883',
  },
});

Upvotes: 0

Views: 388

Answers (1)

whygee
whygee

Reputation: 1984

Have you installed @nest/microservices?

Try npm i --save @nestjs/microservices or yarn add @nestjs/microservices if you are using yarn

You should be able to import what you need

import { Transport, MicroserviceOptions } from '@nestjs/microservices';

Upvotes: 1

Related Questions