In this chapter, we will look at the middleware system used by Express and see how it enables us to create modular web applications. This chapter will cover the following topics:
How the middleware system works
Creating configurable middleware
Differences between the router and the middleware system
Why loading middleware in order matters
Handling errors using middleware
Mounting subapplications with Express
Creating a middleware system similar to the one used in Express