Defining HTTP Middleware and Best Practices

In order to capture API calls from arbitrary environments, we had to create middleware for many of the common web API frameworks. Some of what we learned is presented here to help those creating middleware also.
Introduction to HTTP Middleware
What Is Middleware?
I use the term middleware, but each language/framework refer to the concept differently. NodeJS and Rails call it middleware. In the Java enterprise world (i.e. Java Servlet), it’s called filters. C# calls it delegate handlers. Essentially, middleware performs some specific function on the HTTP request or response at a specific stage in the HTTP pipeline before or after the user defined controller. Middleware is a design pattern to eloquently add cross cutting concerns like logging, handling authentication, or gzip compression without having many code contact points.

Link: https://dzone.com/articles/what-is-http-middleware-and-best-practices?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev