Middleware in Django is a framework that allows code to hook into the response / request processing and alter the input or output of Django.
In Go Middleware can be used to execute code before and after handler function. It uses the power of Single Function Interfaces. Can be introduced at any time without affecting the other middleware. For Ex: Authentication logging can be added in later stages of development without disturbing the existing code.
For some time I've searched for the best way to log requests and response in an ASP.Net Core. I was developing services and one of the requirements was to record request with its response in one record the the database. So many topics out there but none worked for me. it's either for request only, response only or simply didn't work. When I was able to finally do it, and it had evolved during my project to better error handling and logging exceptions so I thought of sharing.