Concept Flow - Applying middleware to routes
Define Middleware Function
Create Middleware Class
Apply Middleware in Module
Specify Routes or Route Patterns
Incoming Request Matches Route?
No→Skip Middleware
Yes
Middleware Executes
Pass Control to Next Handler
Route Handler Executes
Middleware is defined, applied to specific routes, and runs on matching requests before the route handler.