Express bases all of its functionality on a key concept: middleware. If you work with plain vanilla Node, you have to write a single large request handler that will have to take care of all of the requests your server may receive. By using middleware, Express lets you break down this process into smaller pieces, in a more functional, pipeline-ish sort of way. If you need to check security, log requests, handle routing, and so on, all will be done by appropriately placed middleware functions.
First, let's understand how Express differs from Node, see how we can add some basic middleware of our own, and only then move on to apply the usual functions for common needs. Refer to the following diagram for more information:
In standard processing...