const class draft::Route

sys::Obj
  draft::Route

Source

Route models how a URI pattern gets routed to a method handler. Example patterns:

Pattern         Uri           Args
--------------  ------------  ----------
"/"             `/`           [:]
"/foo/{bar}"    `/foo/12`     ["bar":"12"]
"/foo/*"        `/foo/x/y/z`  [:]
"/foo/{bar}/*"  `/foo/x/y/z`  ["bar":"x"]
handler

const Method handler

Source

Method handler for this route. If this method is an instance method, a new intance of the parent type is created before invoking the method.

make

new make(Str pattern, Str method, Method handler)

Source

Constructor.

match

[Str:Str]? match(Uri uri, Str method)

Source

Match this route against the request arguments. If route can be be matched, return the pattern arguments, or return null for no match.

method

const Str method

Source

HTTP method used for this route.

pattern

const Str pattern

Source

URI pattern for this route.