JavaScript Simple Http Server with Pipeline using Node.js

This demo is similar to https://kenanhancer.com/2018/01/18/javascript-pipeline-example-with-es6/
The difference between demo of previous post and this post is the object passed to the pipeline is builded by a request that client made. So that every http request will have its own middlewares pipeline.

https://gist.github.com/kenanhancer/ba63562d3171fe3fa4aa021df2663c3e

JavaScript Pipeline Demo with ES6

I want to demonstrate Chain of Responsibility Behavioral Pattern in this demo. Notice that I have three methods named as middleware1(), middleware2() and middleware3() which includes business logic. Modern web frameworks like Express for Node.js work in this way. The reason we need this development is to seperate concerns so that we can implement seperation of concerns(SoC) design principle.