This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

hono-rate-limit
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

hono-rate-limit

Basic rate-limiting middleware for the Hono.js web server

Installation

npm i hono-rate-limit

Usage

Import dependencies

import { Hono } from "hono";
import RateLimit from "hono-rate-limit";

Configure your rate limit

import { Hono } from "hono";
import RateLimit from "hono-rate-limit";

const app = new Hono();

app.use(
  "/*",
  RateLimit({
    windowMs: 2000,
    limit: 1,
    store: "local", // or redis
    message: "Too many requests", // just text supported
    statusCode: 429,
    // redisOptions: { url: 'redis://alice:foobared@awesome.redis.server:6380' }
  })
);

serve({
  fetch: app.fetch,
  port: 3000,
}).addListener("listening", async () => {
  console.log("Server is running on port 3000");
});

export default app;

Package Sidebar

Install

npm i hono-rate-limit

Weekly Downloads

4

Version

1.0.2

License

Apache-2.0

Unpacked Size

21.1 kB

Total Files

9

Last publish

Collaborators

  • mrlol