Q1. What is middleware in web development?
Middleware is code that runs before (or after) your main route handler, on every request that matches its scope. It is used for cross-cutting concerns like authentication, logging, and rate limiting so the same logic does not get copy-pasted into every route.