You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nestjs-async api package doesn't require chromium (which is required by asyncapi lib), so u can skip chromium
installation by setting PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true environment variable.
$ PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm i --save nestjs-asyncapi
Quick Start
Include AsyncApi initialization into your bootstrap function.
asyncfunctionbootstrap(){constapp=awaitNestFactory.create<NestExpressApplication>(AppModule);constasyncApiOptions=newAsyncApiDocumentBuilder().setTitle('Feline').setDescription('Feline server description here').setVersion('1.0').setDefaultContentType('application/json').addSecurity('user-password',{type: 'userPassword'}).addServer('feline-ws',{url: 'ws://localhost:3000',protocol: 'socket.io',}).build();constasyncapiDocument=awaitAsyncApiModule.createDocument(app,asyncApiOptions);awaitAsyncApiModule.setup(docRelPath,app,asyncapiDocument);// other bootstrap procedures herereturnapp.listen(3000);}
AsyncApi module explores Controllers & WebSocketGateway by default.
In most cases you won't need to add extra annotation,
but if you need to define asyncApi operations in a class that's not a controller or gateway use the AsyncApi class
decorator.
Mark pub/sub methods via AsyncApiPub or AsyncApiSub decorators