Chapter 5. Routing

This chapter covers

  • Simple and pattern-matching routing
  • Using middleware with routing
  • Serving static files with express.static, Express’s built-in static file middleware
  • Using Express with Node’s built-in HTTPS module

As you’ve seen, routing is one of Express’s big features, allowing you to map different requests to different request handlers. In this chapter, we’ll go far more in depth. We’ll look at routing in detail, show how to use Express with HTTPS, explore Express 4’s new routers features, and more. We’ll also build a couple of routing-centric applications, one of which will be a running example throughout the remainder of the book.

In this chapter, I’ll tell you everything there is to know about routing in ...

Get Express in Action: Writing, building, and testing Node.js applications now with O’Reilly online learning.

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