Lesson 7.3

Mounting - prefixes, params, and scope

Segment-aligned prefix matching, byte-preserving inner paths, root mounts, and merged captures. Then you build app.use and the mount helpers.

30 minsrc/app.js
  • Match a prefix segment by segment so /orgs never grabs /orgsx, capturing any :param in the prefix.
  • Strip the prefix without normalizing the remaining path and default an empty result to /.
  • Merge prefix-captured params under the inner match's, inner winning on a collision, null-prototype throughout.
  • Build app.use in three forms and the pure helpers that back a mount.
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