OX::Application::Role::Router - base role for applications with routers
This is an abstract role for creating applications based on a router. You probably want to use OX::Application::Role::Router::Path::Router instead, unless you need to use a different router.
This role adds a
Router service to the application container,
which can be configured by the
It also overrides
build_app to automatically build a PSGI application from the routes in the router.
This role also defines the
ox.router key in the PSGI environment,
so that the application code and middleware can easily access the router.
Required method which should return the class name which the router object itself will be an instance of.
Required method which should take a router instance and return a PSGI application coderef.
This method returns the router instance that is in use.
It is equivalent to
$app->resolve(service => 'Router').
This method is called by the
Router service to create a new router instance.
new on the specified
It is passed the
Router service object,
so that you can access the resolved dependencies you specify in
This method is called after a new router is instantiated, to allow you to add routes to the router (or do whatever other configuration is necessary).
This method returns a hashref of dependencies,
as described in Bread::Board.
The arrayref form of dependency specification is not currently supported.
These dependencies can be accessed in the
This software is copyright (c) 2013 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.