get<T extends Object> static method

Route get<T extends Object>(
  1. String route,
  2. dynamic controller
)

get route. controller is a function, or with a type T a function that picks the method of a controller from the container.

Route.get<UserController>('users', (UserController c) => c.index);
Route.get('ping', (DoxRequest req) => 'pong');

The other methods (post, put, patch, delete, ...) work the same.

Implementation

static Route get<T extends Object>(String route, dynamic controller) {
  return Route()._addRoute(
    HttpRequestMethod.GET,
    Route()._join(route),
    _action<T>(controller),
  );
}