route method

RequestController route (String pattern)

Adds a route to this instnace and provides a forwarding RouteController for all Requests that match that route to be delivered on.

This method will create an instance of a RouteController and attach it to this router, returning the RouteController instance to allow further RequestControllers to be attached.

The pattern must follow the rules of route patterns (see the guide for more explanation). A pattern consists of one or more path segments. A path segment can be a constant string, a path variable (a word prefixed with the : character) or the wildcard character (the asterisk character ) /constantString/:pathVariable/ Path variables may optionally contain regular expression syntax within parentheses to constrain their matches. /:pathVariable(\d+) Path segments may be marked as optional by using square brackets around the segment. The opening square bracket may be on either side of the preceding path delimiter (/) with no effect. /constantString/:optionalVariable /constantString/:optionalVariable Routes may have multiple optional segments, but they must be nested. /constantString/[:optionalVariable/optionalConstantString] Routes may also contain multiple path segments in the same optional grouping. /constantString/segment1/segment2


RequestController route(String pattern) {
  var routeController = new RouteController(
  return routeController;