1.2.0 • Published 11 months ago

shadow-rate-limitter v1.2.0

Weekly downloads
-
License
-
Repository
-
Last release
11 months ago

SHADOW-RATE-LIMITTER PACKAGE BUNDLE

checkout this Ui component created by shadow:- https://github.com/shubham9069/Shadow-UI-React-Example

Badges

MIT License GPLv3 License AGPL License

Related Link

  • NPM

    To install this package into another application as part of its production build steps, you can follow these general steps:-

    1. Run npm install: during the production build process, run npm install to install dependencies. npm will fetch the package specified in the package.json and install it into the node_modules directory of your project.

    2. Include the Package in Your Project: Run this command

     npm i shadow-rate-limitter
<br/>

## Step to use:-

 ```javascript
  const {RateLimitter} = require("shadow-rate-limitter")
 const rateLimitter = new RateLimitter()
 const middleware1 = rateLimitter.userRateLimitter(max_Request, Time)

MiddleWare Function:-

 const middleware1 = rateLimitter.userRateLimitter(max_Request, Time)
ParameterTypeDescription
max_RequestNumberRequired. No of Request Allow
TimeNumberRequired. Time period of (Time should be in milli secound )

Example:-

const express = require("express");
const {RateLimitter} = require("shadow-rate-limitter")
const app = express();


const rateLimitter = new RateLimitter()
const middleware1 = rateLimitter.userRateLimitter(5,1000 * 10)
const middleware2 = rateLimitter.userRateLimitter(2,1000 * 10)
app.use(express.json());
app.get("/health-check1", middleware1,async function (req, res) {

   return res.json({ status: 200, message: "100 % working " })
});
app.get("/health-check2", middleware2,async function (req, res) {

   return res.json({ status: 200, message: "100 % working " })
});


app.listen(8000, async () => {
   console.log(`Server Running...8000`)
});

License

MIT

1.2.0

11 months ago

1.1.0

11 months ago

1.0.0

11 months ago