Middlewares
One of the most powerful features available with Express is the concept of middleware. The idea behind middleware is that it acts like a stack of filters that every request to your server passes through. Every request passes through each filter and each filter can perform a specific task against the request before it passes through to the next filter.
To understand it better, here is a diagrammatic view of middlewares:
Typically, these filters are used for tasks such as cookie parsing, form-field handling, session handling, authentication, and error handling and logging. The list goes on and on. You can use hundreds of third-party modules as well as simply write your own custom middleware.
Creating custom middleware
Undoubtedly, there will be a time when you want to write your own custom middleware in addition to the existing middleware provided by Connect or any other third party. Before you write your own custom middleware in Node, make it a habit to search through https://www...