Angel has built-in support for controllers. This is yet another way to define routes in a manageable group, and can be leveraged to structure your application in the MVC format. You can also use the group() method of any Router.
The metadata on controller classes is processed via reflection only once, at startup. Do not believe that your controllers will be crippled by reflection during request handling, because that possibility is eliminated by pre-injecting dependencies.
Rather than extending from Routable, controllers act as plugins when called. This pseudo-plugin will wire all your routes for you.
The glue that holds it all together is the Expose annotation:
final String method;
final Pattern path;
final List middleware;
final String as;
final List<String> allowNull;
Allowing Null Values
Most fields are self-explanatory, save for as and allowNull. See, request parameters are mapped to function parameters on each handler. If a parameter is null, an error will be thrown. To prevent this, you can pass its name to allowNull.
Named Controllers and Actions
The other is as. This allows you to specify a custom name for a controller class or action. ResponseContext contains a method, redirectToAction that can redirect to a controller action.