NestJS - GuardsWhich NestJS decorator is used to apply a JWT authentication guard to a controller method?A@JwtAuth()B@UseGuards()C@AuthGuard()D@JwtGuard()Check Answer
Step-by-Step SolutionSolution:Step 1: Recall how guards are applied in NestJSGuards are applied using the @UseGuards() decorator.Step 2: Confirm the correct decorator for JWT guardThe JWT guard class is passed inside @UseGuards(), e.g., @UseGuards(JwtAuthGuard).Final Answer:@UseGuards() -> Option BQuick Check:Apply guard = @UseGuards() [OK]Quick Trick: Use @UseGuards() to apply any guard in NestJS [OK]Common Mistakes:Using non-existent decorators like @JwtAuth()Confusing @AuthGuard() as a decoratorAssuming @JwtGuard() exists
Master "Guards" in NestJS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More NestJS Quizzes Authentication - Session-based authentication - Quiz 2easy Database with Prisma - Schema definition - Quiz 15hard Database with TypeORM - Migrations - Quiz 1easy Guards - Reflector and custom decorators - Quiz 10hard Guards - Guard interface (canActivate) - Quiz 9hard Interceptors - Response transformation - Quiz 5medium Interceptors - Cache interceptor - Quiz 1easy Interceptors - Interceptor interface - Quiz 5medium Middleware - Global middleware - Quiz 11easy Pipes - Pipe binding (parameter, method, controller, global) - Quiz 7medium