19Implementing Express Middleware

Much of the functionality that Express brings to the table is through middleware functions that get executed between the point when the request is received by Node.js and the time that the response is sent. Express uses the connect module to provide a middleware framework that allows you to easily insert middleware functionality on a global or path level or for a single route.

The middleware provided with Express allows you to quickly support serving static files, implement cookies, support sessions, process POST data, and much more. You can even create your own custom middleware functions that can be used to preprocess the requests and provide your own functionality.

This chapter focuses on the basics of ...

Get Node.js, MongoDB and Angular Web Development, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.