पाठ 32 / 33

Rate Limiting

Rate limiting से अपने API को abuse से बचाएँ।

Throttle decorator

Time window में requests को limit करने के लिए @Throttle() guard का उपयोग करें।

import { Throttle } from '@nestjs/throttler';

@Throttle({ default: { limit: 10, ttl: 60000 } })  // 10 requests per minute
@Get()
findAll() { ... }