0.1.6 • Published 2 years ago

vindu v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Vindu

Rate limiter for APIs.

Install

npm i vindu

Usage

const vindu = require('vindu')

const $ = { req, res, db }

function rateLimit(res) {
  res.statusCode = 429
  res.end('')
}

const options = {
  // Requests per minute
  limit: 30,
  // The name of the database collection to use
  collection: 'request'
}

const throttle = await vindu($, options)
if (throttle) {
  return rateLimit($.res)
}

MIT Licensed. Enjoy!

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago