Middleware
In plain terms
Code that sits between a request and the final handler to do shared work.
Going deeper
Middleware processes requests in a chain, handling things like logging, authentication, parsing, or error handling before passing control onward. It keeps cross-cutting logic out of individual route handlers.
Under the hood
Forms an ordered chain where each layer can short-circuit, modify, or pass the request; ordering matters (auth before logging, etc.).
Examples
Express middleware, ASP.NET pipeline, Django middleware, JWT/CORS/logging layers.
Think of it like...
Like airport security checkpoints between the entrance and your gate: everyone passes through the same checks before reaching their destination.