loading
loading
Code that runs between a request coming in and the final route handling it.
Middleware commonly handles redirects, authentication checks, headers, logging, rate limits, or locale routing. It reaches far because it touches many requests.
Plainly
Think of Middleware as roads and power for the app city. Code that runs between a request coming in and the final route handling it.
In practice
Use it when local behavior needs to become a reachable, reliable deployed service. In practice, define the owner, input, output, and failure mode before you rely on it.