Answers for "express limit based on ip"

9

express limit based on ip

const rateLimit = require('express-rate-limit');

const limiter = rateLimit({
  max: 100,
  windowMs: 60 * 60 * 1000,
  message: 'too many requests sent by this ip, please try again in an hour !'
});

app.use('<routes>', limiter);  // eg: app.use('/api', limiter);
Posted by: Guest on July-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language