Module gotham::middleware

source ·
Expand description

Defines types for Middleware, a reusable unit of logic that can apply to a group of requests by being added to the Pipeline in a Router.


  • Defines the types for connecting multiple middleware into a “chain” when forming a pipeline.
  • Defines a cookie parsing middleware to be attach cookies on requests.
  • Middlewares for the Gotham framework to log on requests made to the server.
  • Security based middleware to handle security based sanitizations.
  • Defines a session middleware with a pluggable backend.
  • State driven middleware to enable attachment of values to request state.
  • Request timing middleware, used to measure response times of requests.


  • Middleware has the opportunity to provide additional behaviour to the Request / Response interaction. For example:
  • A type which is used to spawn new Middleware values. When implementing a Middleware, this defines how instances of the Middleware are created.

Derive Macros