NestJS · Senior · Question 38 of 75
How do you protect a Nest GraphQL API from very expensive queries?
- 1Disable all nested fields
- ✓Correct answer: Limit query depth and complexity, use persisted queries for public clients, and batch nested fields with DataLoader
- 3Rely on HTTP rate limiting only
Explanation
One GraphQL request can ask for huge nested data; per-request cost limits complement rate limiting.