Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

GatekeeperMiddleware

siemensikkema edited this page Sep 3, 2021 · 1 revision

GatekeeperMiddleware

Middleware used to rate-limit a single route or a group of routes.

public struct GatekeeperMiddleware: Middleware 

Inheritance

Middleware

Initializers

init(config:keyMaker:error:)

Initialize a new middleware for rate-limiting routes, by optionally overriding default configurations.

public init(config: GatekeeperConfig? = nil, keyMaker: GatekeeperKeyMaker? = nil, error: Error? = nil) 

Parameters

  • config: Override GatekeeperConfig instead of using the default app.gatekeeper.config
  • keyMaker: Override GatekeeperKeyMaker instead of using the default app.gatekeeper.keyMaker
  • config: Override the Error thrown when the user is rate-limited instead of using the default error.

Methods

respond(to:chainingTo:)

public func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response>