Put in order · NestJS course · Module 2: Routing and Request Lifecycle
Getting the Request in a Guard
Arrange the elements of retrieving the request object in a guard's canActivate method:
Items to put in order
- context.switchToHttp()
- const request =
- .getRequest()
Show the answer
Correct order:
- const request =
- context.switchToHttp()
- .getRequest()