Using Pathfinder Directly
Use#
To get started, create a Pathfinder
instance, define your routes, and then match your incoming request:
Routes Definition#
Basic Route#
A basic route is a simple, static path:
Parameterized Route#
To include parameters like a username or ID in the URL:
Regular Expression Constraints#
You can add regex constraints to your parameters:
Optional Parameters#
You can define routes with optional segments:
Complex Routes#
You can also define more complex routes with multiple parameters:
Enumerated Parameters#
For when you have a specific set of acceptable parameter values:
Shortcuts#
For convenience, Pathfinder
offers shortcut methods for common HTTP request methods.
You can use these shortcut methods just like you would use the route method, but without the need to specify the HTTP
method as the first argument.