Skip to content

a simple ratelimit for koa, inspired by koajs/ratelimit

License

Notifications You must be signed in to change notification settings

koexjs/ratelimit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a simple ratelimit for koa, inspired by koajs/ratelimit

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%