Skip to content

Commit

Permalink
added recipe for catch-all route
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 30, 2014
1 parent 117d322 commit 7b52b98
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -663,6 +663,19 @@ L<Mojolicious::Routes::Route/"under">.
$c->render(text => 'Go away.');
});

=head2 Catch-all route

Since routes match in the order in which they were defined, you can catch all
requests that did not match in your last route with an optional wildcard
placeholder.

# * /*
$r->any('/*whatever' => {whatever => ''} => sub {
my $c = shift;
my $whatever = $c->param('whatever');
$c->render(text => "/$whatever did not match.", status => 404);
});

=head2 Hooks

Hooks operate outside the routing system and allow you to extend
Expand Down

0 comments on commit 7b52b98

Please sign in to comment.