Routing
HTTP routing is the process of directing an incoming request to a handler function in your web application.
To register a route handler, call methods named after HTTP verbs, with a path and a handler as arguments.
To handle all methods using a handler, register the handle with any
method:
Patterns
Basic route patterns are supported.
URL parameters
Capture the value of a part separated by slash characters of the pathname.
Example cases:
/user/123
: Return123
./user/456/info
: Does not match the pattern./user
: Does not match the pattern.
Wildcards
Capture a slice from a specific part of a pathname.
Example cases:
/user/123
: Return123
./user/456/info
: Return456/info
./user
: Does not match the pattern.
The type of ctx.params
is inferred automatically from the registered pattern.
Sub-routers
To register all handlers from other Byte
instance: