@koex/ratelimit
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

ratelimit

NPM version Coverage Status Dependencies Build Status license issues

ratelimit for koa extend

Install

$ npm install @koex/ratelimit

Usage

// See more in test
import ratelimit from '@koex/ratelimit';

import * as Koa from 'koa';
const app = new Koa();
app.use(ratelimit());
app.use(async (ctx) => {
  if (ctx.path === '/') {
    ctx.body = 'hello, world';
  } else if (ctx.path === '/json') {
    ctx.body = {
      name: 'name',
      value: 'value',
    };
  }
});

app.listen(8000, '0.0.0.0', () => {
  console.log('koa server start');
});

Related

Readme

Keywords

none

Package Sidebar

Install

npm i @koex/ratelimit

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

10.5 kB

Total Files

6

Last publish

Collaborators

  • uniquecolesmith