Middleware hija framework ta' hooks li jipproċessja kull request u response globalment, sitta bejn il-web server u l-views tiegħek. Kull middleware jista' jispezzjona/jimmodifika requests meta jidħolux u responses meta joħorġux — ideali għal cross-cutting concerns bħal authentication, security headers, sessions, u logging.
Il-flow ta' request/response permezz tal-middleware
Request → MW1 → MW2 → MW3 → VIEW
Response ← MW1 ← MW2 ← MW3 ← VIEW
Middleware wraps the view like layers of an onion:
- on the way IN (request): top-to-bottom
- on the way OUT (response): bottom-to-top (reverse order)
