Middleware Pipelines - Promises
I’ve been looking at the possibilities of a simple middleware pipeline script. So far I’ve implemented a version of the Chain of Responsibility pattern. I’ve also been looking at using the same builder to work with promises. Here is what I’ve found.
Fetching some data from an API
So for this example I will define a few interfaces defining the data I am working with.
The context for each middleware function is going to be an object with a request and a response. This means that the middleware can work with either during each step.
Dave Taylor - Software Engineer