Skip to content

qps-limit is a node.js package for providing an Express middleware that can be used to limit qps.

Notifications You must be signed in to change notification settings

fengliner/qps-limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qps-limit

qps-limit is a node.js package for providing an Express middleware that can be used to limit qps.

Installation (via npm)

$ npm install qps-limit

Usage

var express = require('express')
var qps = require('qps-limit');
var app = express()

app.use(qps({
  limit: 100  // number of qps limit
}));

app.get('/user/:id', function (req, res, next) {
  res.send({
    code: 0,
    data: {id: 1, name: 'fengliner'}
  });
})

app.listen(3000, function () {
  console.log('qps limit web server listening on port 3000')
})

Configuration Options

  • limit: Configures the number of qps limit. Default 1000.

The default configuration is the equivalent of:

{
  "limit": 1000,
}

About

qps-limit is a node.js package for providing an Express middleware that can be used to limit qps.

Resources

Stars

Watchers

Forks

Packages

No packages published