Middleware functions are mainly used to make changes in the request and response object. They are executed in sequence, one after another, but if a middleware functions does not pass control to the next one, the request is left hanging.
Writing middleware functions
Getting ready
Middleware functions have the following signature:
app.use((request, response, next) => { next() })
The signature is very similar to writing route handlers. In fact, a middleware function can be written for a specific HTTP method and a specific path route, and will look like this, for example:
app.get('/', (request, response, next) => { next() })
So, if you are wondering what the difference is between route handlers, and...