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
Decoding a payload into a JSON object requires the following extra code on every single controller.
@Consume('queueName')functionhandleCreatedEvent(content: string){consteventData=JSON.parse(content)// do something with the eventData object}
Eventually, I'd like to implement a decorator that decodes the JSON payload automatically and potentially runs validation checks (with Data Transfer Objects) against it. NestJS already provides something similar for their HTTP controllers:
NestJS Implementation with HTTP
@Get('/')functionfindAll(@Body()payload: payloadDTO){// do something with `payload` already decoded into a JS object}
What I want to achieve
@Consume('queueName')functionhandleCreatedEvent(@EventPayload()payload: payloadDTO){// do something with the payload object}
The text was updated successfully, but these errors were encountered:
Decoding a payload into a JSON object requires the following extra code on every single controller.
Eventually, I'd like to implement a decorator that decodes the JSON payload automatically and potentially runs validation checks (with Data Transfer Objects) against it. NestJS already provides something similar for their HTTP controllers:
NestJS Implementation with HTTP
What I want to achieve
The text was updated successfully, but these errors were encountered: