@req-json/rate-limit
v1.0.2
Published
Rate limit middleware for req-json.
Downloads
8
Maintainers
Readme
@req-json/rate-limit
Rate limit middleware for req-json.
Installation
NPM
npm install @req-json/rate-limit --save
import ReqJSON from 'req-json';
import reqJSONRateLimit from '@req-json/rate-limit';
const reqJSON = new ReqJSON();
reqJSON.use(reqJSONRateLimit());
Browser
Direct <script>
include window.reqJSONRateLimit
<script src="https://cdn.jsdelivr.net/npm/@req-json/rate-limit@1"></script>
Options
Rate limit middleware options and defaults.
reqJSON.use(reqJSONRateLimit({
methods: [ // request methods to apply rate limit
'POST',
'PUT'
],
frequency: 1000 // request only once in 1000ms
}));