jargon

Design patterns·Functional ideas that went mainstream

each function takes the next one and returns a new one, so authentication wrapped logging wrapped the actual handler.

Middleware

Also calledmiddleware function, middleware stack, onion middleware

A composable wrapper around a handler that can act before it, after it, or instead of it, stacked into a pipeline. It is the decorator pattern written as functions and assembled as a chain of responsibility, which is why it is the shape every web framework converged on independently. Its recurring difficulty is order: authentication before rate limiting and rate limiting before authentication are different products.

Commonly confused with