Paquete: npm install --save rate-limit-mongo
RUTA:
routes.get( "/example", general, // This is my rate limit (req, res) => { return res.status(201).end() } )INTERMEDIO:
module.exports.general = new RateLimit({ store: new MongoStore({ uri: process.env.MONGODB_CNN + "api-limiter", expireTimeMs: 15 * 60 * 1000, errorHandler: console.error.bind(null, 'rate-limit-mongo'), collectionName: "general", }), max: 50, windowMs: 15 * 60 * 1000, skipSuccessfulRequests: true });Gracias de antemano