Chapter 6. Connect

In this chapter

  • Setting up a Connect application
  • How Connect middleware works
  • Why middleware ordering matters
  • Mounting middleware and servers
  • Creating configurable middleware
  • Using error-handling middleware

Connect is a framework that uses modular components called middleware to implement web application logic in a reusable manner. In Connect, a middleware component is a function that intercepts the request and response objects provided by the HTTP server, executes logic, and then either ends the response or passes it to the next middleware component. Connect “connects” the middleware together using what’s called the dispatcher.

Connect allows you to write your own middleware but also includes several common components ...

Get Node.js in Action 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.