Not found

A path of '*' matches anything. Routes match from the top down, so a catch-all placed last only ever sees the paths the routes above it did not take. That makes it the app's 404 page.

/albums/nope never reaches it: :id matches any segment, so the album route takes it, and Album.pzl shows its "isn't here" branch. A path like /records matches nothing until you add the catch-all.

Your turn

  1. Type /records into the address bar. The console reports that no route matches.
  2. In routes.js, import NotFound from ./views/NotFound.pzl and add { path: '*', name: 'not-found', view: NotFound, layout: Default } at the end of the table.
  3. Try /records again, then /albums/nope.

Keep the catch-all last. Anything after it can never match.

That is the router. Chapter 4 gives Music a real datastore.

Chapters