Mux.jl route vs page

I am trying to determine best practices for using route versus page, but don’t understand the differences between these two functions.

The documentation describes page as being more strict with exact request location matches, but I’m still trying to come up with an example of a request location and target path that matches with route, but not with page.

route(“/path/here”, app) – branches to app if the request location matches “/path/here”.
page(“/path/here”, app) – branches to app if the request location exactly matches “/path/here”

According to the code, it seems that this example needs a request location length that is different than the target length, but that still works with matchpath!.

As I understand it, the difference between route and page is that page is intended to be terminal (or a “leaf”, if you prefer), whereas route can be used to nest apps within other apps.

1 Like