You can create typed routes by using pathScan() with standard format specifiers. pathScan() uses PrintfFormat and so your path is statically typed; the compiler will complain if the number of parameters in the path doesn’t match the handler.
The matching path segments are passed to your handler in a tuple. Here’s an example:
Note that there is no “>=>” between the path string and the handler.
If you need to access the request, just construct the WebPart your handler returns with context() or request(). Modifying the previous example: