NestJS - AuthenticationWhy is it important that guards in NestJS return a boolean or a Promise?ABecause guards are only allowed to return synchronous valuesBBecause guards must always return true to avoid errorsCBecause NestJS uses the return value to decide if route execution proceedsDBecause returning other types causes the server to crashCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand guard return typesGuards return boolean or Promise to indicate allow or deny access.Step 2: Explain why this mattersNestJS uses this return value to decide if the route handler should run or be blocked.Final Answer:Because NestJS uses the return value to decide if route execution proceeds -> Option CQuick Check:Guard return controls route access [OK]Quick Trick: Return boolean or Promise in guards [OK]Common Mistakes:Thinking guards must always return trueBelieving other return types cause crashesAssuming guards cannot return promises
Master "Authentication" in NestJS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More NestJS Quizzes Authentication - Local strategy (username/password) - Quiz 11easy Database with Prisma - Why Prisma offers type-safe database access - Quiz 8hard Database with Prisma - CRUD with Prisma - Quiz 6medium Database with Prisma - Prisma Client usage - Quiz 3easy Database with TypeORM - Relations (OneToMany, ManyToOne, ManyToMany) - Quiz 3easy Guards - Combining multiple guards - Quiz 11easy Guards - Role-based guards - Quiz 13medium Interceptors - Response transformation - Quiz 1easy Pipes - Custom pipes - Quiz 7medium Pipes - Built-in pipes (ParseIntPipe, ParseBoolPipe) - Quiz 7medium