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
AsyncApi module explores `Controllers` & `WebSocketGateway` by default.
56
+
In most cases you won't need to add extra annotation,
57
+
but if you need to define asyncApi operations in a class that's not a controller or gateway use `AsyncApiClass` decorator.
58
+
59
+
Mark pub/sub methods via `AsyncApiPub` or `AsyncApiSub` decorators<br/>
60
+
61
+
```typescript
62
+
classCreateFelineDto {
63
+
@ApiProperty()
64
+
demo:string;
179
65
}
180
66
181
-
const baseUrl =`http://${host}:${port}`;
182
-
const startMessage =`Server started at ${baseUrl}; AsyncApi at ${baseUrl+docRelPath};`;
67
+
@Controller()
68
+
classDemoController {
69
+
@AsyncApiPub({
70
+
channel: 'create/feline',
71
+
payload: CreateFelineDto,
72
+
})
73
+
async createFeline() {
74
+
// logic here
75
+
}
76
+
77
+
@AsyncApiSub({
78
+
channel: 'create/feline',
79
+
payload: CreateFelineDto,
80
+
})
81
+
async createFeline() {
82
+
// logic here
83
+
}
84
+
}
183
85
184
-
bootstrap().then(() =>console.log(startMessage));
185
86
```
87
+
88
+
For more detailed examples please check out https://github.com/flamewow/nestjs-asyncapi/tree/main/sample sample app.
89
+
90
+
<h5>Do you use this library and like it? Don't be shy to give it a star on <ahref="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/flamewow/nestjs-asyncapi">github <spanstyle="color:yellow;">★</span></a></h3>
0 commit comments