NAME
Mojolicious::Plugin::AutoRoute - Mojolicious Plugin to create routes from templates
SYNOPSIS
# Mojolicious
$self->plugin('AutoRoute');
# Mojolicious::Lite
plugin 'AutoRoute';
# Your route
$self->puglin('AutoRoute', {route => $self->routes});
DESCRIPTION
Mojolicious::Plugin::AutoRoute is a Mojolicious plugin to create routes automatically from templates.
Routes is autocatically create searching templates
($app->renderer->paths) directory.
For example, if you set template, routes is automatically created.
TEMPLATES ROUTES CONTROLLER/ACTION
templates/index.html.ep # / (Index::main)
/foo.html.ep # /foo (Index::foo)
/foo/bar.html.ep # /foo/bar (Foo::Bar)
/foo/bar/baz.html.ep # /foo/bar/baz (Foo::Bar::baz)
If you like PHP
, this plugin is very good.
OPTIONS
route
route => $app->routes->under(sub { ... });
You can set your route, defaults to $app-
routes>.
ignore
ignore => [qw/layouts include/]
Ignored directory.
METHODS
Mojolicious::Plugin::AutoRoute inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register($app);
Register plugin in Mojolicious application.