NestJS · Middle · Question 3 of 75
What is ExecutionContext used for?
- 1It runs code in a separate thread
- 2It stores global configuration
- ✓Correct answer: It gives guards and interceptors the current handler, class and request, and lets one implementation work for HTTP, RPC and WebSockets
Explanation
context.switchToHttp().getRequest(), context.getHandler(), context.getClass() and context.getType() are the common calls.