{"library":"reqlim","title":"reqlim: Request Limiting Middleware","description":"reqlim is a Connect/Express middleware designed to limit incoming requests, acting as a direct adaptation of the popular `express-rate-limit` package. Its primary function is to prevent abuse by restricting the number of requests a user can make within a specified timeframe, returning a 429 'Too Many Requests' status when limits are exceeded. Despite its utility, the package remains at an early development stage with version 0.0.0 and has not seen active development since its initial publication over four years ago. This makes it an effectively abandoned project. Developers seeking a stable, actively maintained, and feature-rich rate-limiting solution for Express applications should opt for `express-rate-limit` directly, which served as the inspiration for `reqlim` and offers continuous updates, bug fixes, and better community support, including TypeScript definitions.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install reqlim"],"cli":null},"imports":["const rateLimit = require('reqlim')","app.use(rateLimit({ windowMs: 60 * 1000, max: 5 }))","rateLimit({ windowMs: 60000, max: 100, statusCode: 429 })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const express = require('express');\nconst rateLimit = require('reqlim');\n\nconst app = express();\nconst port = 3000;\n\n// Basic rate limiting middleware: 5 requests per minute per IP\nconst limiter = rateLimit({\n  windowMs: 60 * 1000, // 1 minute\n  max: 5, // Limit each IP to 5 requests per `window`\n  message: 'Too many requests from this IP, please try again after a minute',\n  headers: true, // Send rate limit info in headers\n  onLimitReached: (req, res, options) => {\n    console.log(`IP ${req.ip} has reached the limit on ${req.url}`);\n  }\n});\n\n// Apply the rate limiting middleware to all requests\napp.use(limiter);\n\n// Define a simple route\napp.get('/', (req, res) => {\n  res.send('Hello World! You are being rate limited.');\n});\n\n// Start the server\napp.listen(port, () => {\n  console.log(`Server listening at http://localhost:${port}`);\n  console.log('Try to make more than 5 requests in a minute to see the rate limit in action.');\n});","lang":"javascript","description":"This quickstart demonstrates how to set up `reqlim` as a global middleware for an Express application, limiting requests to 5 per minute per IP address. It includes basic configuration, a custom message, and an `onLimitReached` callback for logging.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}