Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express js limit access based on rate

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);
 
PREVIOUS NEXT
Tagged: #express #js #limit #access #based #rate
ADD COMMENT
Topic
Name
1+1 =