Mojolicious::Plugin::PlainRoutes - Plaintext route definitions for Mojolicious
version 0.07
In lib/MyApp.pm:
sub startup { ... $self->plugin('PlainRoutes'); ... }
In lib/myapp.routes:
# Routes file for MyApp.pm ANY / -> Foo.do { GET /bar -> Foo.bar ANY /baz -> Foo.baz { GET /quux -> Foo.quux } } GET /foo/bar/baz/quux -> Foo::Bar::Baz.quux (fbb-quux)
Routes are defined as an HTTP verb, followed by a path, followed by a controller/action pair. (The arrow is optional.) An optional name for the route can be appended with parentheses.
If a route is followed by braces, then it will act as a bridge for the contained routes.
Anything following a "#" is a comment until the end of the line, as in Perl.
$self->plugin('PlainRoutes', { # Specify the path of the routes file file => $self->home->rel_file('path/to/myapp.routes'), # Get automatic names for routes of the form "controller-action" autoname => 1, # or do it with a callback autoname => sub { my ($verb, $path, $controller, $action) = @_; return "$controller-$action"; }, });
Use the issue tracker on the Github repository for bugs/feature requests:
https://github.com/RogerDodger/Mojolicious-Plugin-PlainRoutes/issues
Cameron Thornton <cthor@cpan.org>
This software is copyright (c) 2021 by Cameron Thornton.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mojolicious::Plugin::PlainRoutes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::PlainRoutes
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::PlainRoutes
For more information on module installation, please visit the detailed CPAN module installation guide.