Giter Site home page Giter Site logo

Comments (5)

nfriedly avatar nfriedly commented on May 18, 2024

This is possible currently by creating two instances:

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

var limiterA = rateLimit({
  windowMs: 60*60*1000, // 1 hour
  max: 50
  delayAfter: 0, // disable delaying
});
app.use('/routeA', limiterA);

var limiterB = rateLimit({
  windowMs: 60*1000, // 1 minute
  max: 30
  delayAfter: 0, // disable delaying
})
app.use('/routeB', limiterB);

Will that meet your needs?

from express-rate-limit.

jazoom avatar jazoom commented on May 18, 2024

I guess it will. I did think of doing that but I assumed it was a singleton since there was no new keyword.

Thanks for the info!

from express-rate-limit.

nfriedly avatar nfriedly commented on May 18, 2024

Yea, I should probably change that...

from express-rate-limit.

nfriedly avatar nfriedly commented on May 18, 2024

There we go, I updated the readme to be a bit more clear (it's actually works either way, but using new should make things a bit more clear) and I added a section for creating different instances for different routes. Should be live as v2.1.3 shortly, although there weren't any code changes.

from express-rate-limit.

jazoom avatar jazoom commented on May 18, 2024

Great stuff! Thanks.

from express-rate-limit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.