Lesson 7.2

Router.use and request state

The three bands in a per-request stack, router-scoped middleware storage, and a req.user field for middleware state.

18 minsrc/router.js, src/request.js
  • Name the three bands of a composed stack and say which registration call feeds each.
  • Add Router.use and a _middleware list that only runs when the router is mounted.
  • Add the req.user field at its fixed constructor position and explain why fields are declared during construction.
Locked

This chapter is part of the framework capstone. Chapters 1 and 2 are free to build - unlock the rest to keep going.

Unlock the depth