Want to intercept incoming requests before they are processed and outgoing responses before returning them middleware is the best choice. @princewilldev explained the middleware part in the FastAPI world and also implemented one to understand better in this article