19. Implementing Express Middleware

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

The middleware supported by Express allows you to quickly serve static files, implement cookies, support sessions, process POST data, and much more. You can even create your own custom middleware functions and use them to preprocess requests and provide your own functionality.

This chapter focuses on the basics of implementing Express middleware. ...

Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.