[]previous and next page

RateLimitMiddlewareOptions

Options of the rate limit middleware.

Options of the rate limit middleware.

Import#

ts
import type { RateLimitMiddlewareOptions } from "@shadow-js/dusk/server";

Signature#

ts
interface RateLimitMiddlewareOptions {
  /** The key to limit by. Default: the client address (IPv6 by /64); requests without one share one bucket. */
  readonly key?: (event: RequestEvent) => string | Promise<string>;
  /** Tokens one request costs. Default 1. */
  readonly cost?: number;
}

Members#

Name Type Description
key? readonly key?: (event: RequestEvent) => string | Promise<string> The key to limit by. Default: the client address (IPv6 by /64); requests without one share one bucket.
cost? readonly cost?: number Tokens one request costs. Default 1.