Introduction
Middleware helps your app handle requests step-by-step. It lets you add features like logging or checking users before doing the main work.
You want to log every request to see who visits your site.
You need to check if a user is logged in before showing a page.
You want to handle errors in one place instead of everywhere.
You want to add data to requests that later parts of your app can use.