Imagine you have an API where calls to a route need to be limited. But you May have many URLs being under the route you want to limit.
for instance:
You have and API and want to limit all routes starting by /limited. All of them using the same limit.
As far as I know if I setup:
`
const RateLimiter = require('express-limit').RateLimiter;
const InMemoryStore = require('express-limit').InMemoryStore;
const store = new InMemoryStore();
const limit = (options = {}) => {
options.store = store;
return new RateLimiter(options).middleware;
};
app.use('/URI', limit);
router.get('/URI/A', (req, res, next) => {
res.status(200).json({});
});
router.get('/URI/B', (req, res, next) => {
res.status(200).json({});
});
`
both paths: /URI/A & /URI/B will be limited but they won't share the limit. I mean If I setup 1 request per minute 1 can do 1 request per minute to each path not 1 request per minute to ANY of the paths.
It will be great if we could setup a prefix so all routes starting by /URI will share the limit no matter if I access URI/A or URI/B
Imagine you have an API where calls to a route need to be limited. But you May have many URLs being under the route you want to limit.
for instance:
You have and API and want to limit all routes starting by /limited. All of them using the same limit.
As far as I know if I setup:
`
const RateLimiter = require('express-limit').RateLimiter;
const InMemoryStore = require('express-limit').InMemoryStore;
const store = new InMemoryStore();
const limit = (options = {}) => {
options.store = store;
return new RateLimiter(options).middleware;
};
app.use('/URI', limit);
router.get('/URI/A', (req, res, next) => {
res.status(200).json({});
});
router.get('/URI/B', (req, res, next) => {
res.status(200).json({});
});
`
both paths: /URI/A & /URI/B will be limited but they won't share the limit. I mean If I setup 1 request per minute 1 can do 1 request per minute to each path not 1 request per minute to ANY of the paths.
It will be great if we could setup a prefix so all routes starting by /URI will share the limit no matter if I access URI/A or URI/B