How to configure whitelist using this module? Guru help
const apiLimiter = (req, res, next) => { const whiteList = [ 'auth0|id', 'auth0|id', 'auth0|id', 'auth0|id', 'auth0|id', ]; let info; if (req.headers.authorization) { const token = req.headers.authorization.split(' '); info = jwtDecode(token[1]); } if (whiteList.includes(info.sub)) next(); else { const limiter = new RateLimit({ windowMs: 1000, // 1 second max: 50, // limit each IP to 10 requests per windowMs delayMs: 0, // disable delaying - full speed until the max limit is reached store: new RedisStore({ client: redisClient, expiry: 1 }), }); limiter(req, res, next); } }; The problem is that such a method creates a new instance every time when prompted, how to be guys?