NestJS · Junior · Question 40 of 75

How do you protect a route with a guard?

Explanation

Guards can also be global (app.useGlobalGuards() or the APP_GUARD provider). A common pattern is a global auth guard plus a @Public() decorator for open routes.

Further reading

Problem with a question

NestJS · Junior · question 40

Test yourself

Take the NestJS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz