-
-
Save anonymous/746d4807bff7984db043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojolicious/Guides/Routing.pod b/lib/Mojolicious/Guides/Routing | |
index 8de3d89..e47eb3e 100644 | |
--- a/lib/Mojolicious/Guides/Routing.pod | |
+++ b/lib/Mojolicious/Guides/Routing.pod | |
@@ -201,6 +201,12 @@ form of a hash using the chained method L<Mojolicious::Rout | |
Now if the route matches an incoming request it will use the content of this | |
hash to try and find appropriate code to generate a response. | |
+ # /welcome -> {controller => 'foo', action => 'welcome'} | |
+ $r->get('/welcome' => {controller => 'foo', action => 'welcome'}); | |
+ | |
+Just like in L<Mojolicious::Lite> you can also pass a hash reference directly, | |
+but that usually doesn't look as nice. | |
+ | |
=head2 HTTP methods | |
There are already shortcuts for the most common HTTP request methods like | |
@@ -809,6 +815,12 @@ The method L<Mojolicious::Routes/"add_condition"> registers | |
in the router, while L<Mojolicious::Routes::Route/"over"> actually applies it | |
to the route. | |
+ # /firefox_only (Firefox) -> {controller => 'foo', action => 'bar'} | |
+ $r->get('/firefox_only' => (agent => qr/Firefox/))->to('foo#bar'); | |
+ | |
+Just like in L<Mojolicious::Lite> you can also pass pairs directly, but that | |
+usually doesn't look as nice. | |
+ | |
=head2 Condition plugins | |
You can also package your conditions as reusable plugins. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment