Lesson 5.4

Keyed by method, and the App that owns the router

Why the router keeps one whole tree per HTTP method, the App that composes the Router with the Server, strict option validation, the dispatch entry, the byte-frozen 404 miss path, and the public barrel.

30 minsrc/app.js, src/index.js, src/connection.js
  • Explain the one-tree-per-method design and why the hot path never tests a method below the tree selection.
  • Compose the pure Router with the Server behind an App with createApp, route, get, handle, listen, and close.
  • Emit the byte-frozen 404 miss path and expose exactly the five public symbols through the barrel.
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