Skip to content

Commit

Permalink
Double rate limit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed Jun 30, 2018
1 parent 3b42b8c commit ac953fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ app.use(cors())
app.enable('trust proxy');
let limiter = new RateLimit({
windowMs: 60000, // 1 minute
max: 20, // limit each IP to 20 requests per windowMs
max: 40, // limit each IP to 20 requests per windowMs
delayMs: 0, // disable delaying - full speed until the max limit is reached
handler: function (req, res, /*next*/) {
res.format({
json: function(){
res.status(500).json({ error: 'Too many requests. Limits are 20 requests per minute.'});
res.status(500).json({ error: 'Too many requests. Limits are 40 requests per minute.'});
}
});
}
Expand Down

0 comments on commit ac953fe

Please sign in to comment.