Interceptors
์ผ๋ฐ ์ธํฐ์ ํฐ์ ๋ง์ดํฌ๋ก ์๋น์ค ์ธํฐ์ ํฐ ์ฌ์ด์๋ ์ฐจ์ด๊ฐ ์์ต๋๋ค. ๋ค์์ ์๋์ผ๋ก ์ธ์คํด์คํ๋ ๋ฉ์๋ ๋ฒ์ ์ธํฐ์ ํฐ๋ฅผ ์ฌ์ฉํ๋ ์์ ์ ๋๋ค (ํด๋์ค ๋ฒ์๋ ์๋ ํจ).
@@filename()
@UseInterceptors(new TransformInterceptor())
@MessagePattern({ cmd: 'sum' })
accumulate(data: number[]): number {
return (data || []).reduce((a, b) => a + b);
}
Last updated
Was this helpful?