Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created September 9, 2021 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsh-code/47837320a23adfae43705911744049c2 to your computer and use it in GitHub Desktop.
Save tsh-code/47837320a23adfae43705911744049c2 to your computer and use it in GitHub Desktop.
import rateLimit from "express-rate-limit";
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // limit each IP to 100 requests per windowMs
});
// apply rate limiter
app.use(limiter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment