Rate limiting is a technique used to control the rate of traffic sent or received by a network.
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
const ratelimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.fixedWindow(10, "30s"),
});
await ratelimit.limit(ip);
Success | Limit | Remaining | Reset |
---|---|---|---|
- | - | - | - |