Glossary

Middleware

Middleware is an intermediate handler that intercepts an HTTP request before it reaches the controller — or a response before it reaches the client. Middleware form a chain: each one can pass the request along, modify it, or immediately return a response.

Typical uses

The chain-of-responsibility pattern

Each middleware implements one method: receive the request, do its job, pass it on. If a condition is not met — return a response and break the chain. This pattern is framework-agnostic and appears identically in PHP, Python (WSGI), Node.js (Express), and Go.