Book Image

Mastering Web Application Development with Express

By : Alexandru Vladutu
Book Image

Mastering Web Application Development with Express

By: Alexandru Vladutu

Overview of this book

Table of Contents (18 chapters)
Mastering Web Application Development with Express
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Connecting middleware


Middleware refers to reusable components that can be plugged into an Express application. Middleware consists of functions that handle HTTP requests, such as the one we would pass to Node's native http.createServer function. A middleware component can add features by manipulating the request and response objects and then send the response to the client or pass control to the following middleware in the stack. There are a lot of middleware libraries that are compatible with Express, the most popular ones being those that were bundled with it but now live in separate modules (https://github.com/senchalabs/connect#middleware).

Web applications have to deal with a lot of things, such as managing cookies and sessions, handling file uploads, or serving static files. Middleware libraries can address these problems.