Guards
Guards
๋ง์ดํฌ๋ก ์๋น์ค ๊ฐ๋์ ์ผ๋ฐ ๊ฐ๋ ์ฌ์ด์๋ ์ฐจ์ด๊ฐ ์์ต๋๋ค. ์์์ผํ ์ ์ผํ ๊ฒ์ HttpException
์ ๋ฐ์์ํค๋ ๋์ RpcException
์ ์ฌ์ฉํด์ผํ๋ค๋ ๊ฒ์
๋๋ค.
info ํํธ
RpcException
ํด๋์ค๋@nestjs/microservices
ํจํค์ง์์ ๋ ธ์ถ๋ฉ๋๋ค.
Binding guards
๋ค์์ method-scoped guard๋ฅผ ์ฌ์ฉํ๋ ์์ ์ ๋๋ค (class-scoped๋ ์๋ํฉ๋๋ค).
@@filename()
@UseGuards(AuthGuard)
@MessagePattern({ cmd: 'sum' })
accumulate(data: number[]): number {
return (data || []).reduce((a, b) => a + b);
}
Last updated
Was this helpful?