Skip to content

429 Too Many Requests

You’ve hit the rate limit. Slow down and try again later.

Use this for Rate Limiting. If a free-tier user is permitted 100 requests per minute and they send 101, block them with a 429.

import { HttpException, get } from 'shokupan';
export const searchRecords = get('/search', async (req) => {
const rateLimit = await checkRateLimit(req.ip);
if (rateLimit.exceeded) {
throw new HttpException('Too Many Requests. Please wait 60s.', 429);
}
// ... perform search
});