Nietzsche's Preposterous Moustache

    qps-limit

    1.0.1 • Public • Published

    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,
    }

    Install

    npm i qps-limit

    DownloadsWeekly Downloads

    5

    Version

    1.0.1

    License

    none

    Last publish

    Collaborators

    • fengliner