Controller class

MVC approach middleware.

Allows to use MVC approach by mapping route regular expressions to methods and actions.

class TestController extends Controller {
  TestController() {
    routeMap = {
      RegExp(r'\/test\/(.*)$'): {
        RequestMethod.GET: getTestAction,
      },
    };
  }

  void getTestAction(Request req, Response res, String param) {
    res.send('Param: $param');
  }
}
Inheritance

Constructors

Controller()

Properties

routeMap Map<RegExp, Map<RequestMethod, ActionHandler>>
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
list LinkedList<Middleware>
Get the linked list containing this element. [...]
read-only, inherited
next Middleware
Return the successor of this element in its linked list. [...]
read-only, inherited
previous Middleware
Return the predecessor of this element in its linked list. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

afterAction(Request req, Response res) → void
beforeAction(ActionHandler action, Request req, Response res) Future<bool>
run(Request req, Response res, {String baseUrl: '/'}) Future<Middleware>
override
insertAfter(Middleware entry) → void
Insert an element after this element in this element's linked list. [...]
inherited
insertBefore(Middleware entry) → void
Insert an element before this element in this element's linked list. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited
Unlink the element from its linked list. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited