NestJS · Junior · Question 54 of 75
How do you add rate limiting to a Nest API?
- 1With
@nestjs/cors - 2Nest limits requests automatically
- ✓Correct answer: With
@nestjs/throttler:ThrottlerModule.forRoot()and theThrottlerGuard
Explanation
You can set limits per route with @Throttle() or skip them with @SkipThrottle(). Behind a proxy, make sure the real client IP is used.