Skip to content

Commit

Permalink
use more lite routes in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 13, 2012
1 parent 675380f commit 9f55349
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -326,7 +326,7 @@ startup method to define the url endpoints for your application.
my $self = shift;
my $r = $self->routes;
$r->route('/:controller/:action')->to('test#welcome');
$r->get('/:controller/:action')->to('test#welcome');
}
=head2 C<secret>
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/generate/app.pm
Expand Up @@ -87,7 +87,7 @@ sub startup {
my $r = $self->routes;
# Normal route to controller
$r->route('/')->to('example#welcome');
$r->get('/')->to('example#welcome');
}
1;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -1104,7 +1104,7 @@ get automatically installed with the modules.
$self->plugin('PODRenderer');

my $r = $self->routes;
$r->route('/welcome')->to('example#welcome');
$r->get('/welcome')->to('example#welcome');
}

1;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Lite.pm
Expand Up @@ -797,7 +797,7 @@ C<log/$mode.log> file if a C<log> directory exists.
For more control the L<Mojolicious> object can be accessed directly.
app->log->level('error');
app->routes->route('/foo/:bar')->via('GET')->to(cb => sub {
app->routes->get('/foo/:bar' => sub {
my $self = shift;
$self->app->log->debug('Got a request for "Hello Mojo!".');
$self->render(text => 'Hello Mojo!');
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Plugin/HeaderCondition.pm
Expand Up @@ -51,15 +51,15 @@ Mojolicious::Plugin::HeaderCondition - Header condition plugin
# Mojolicious
$self->plugin('HeaderCondition');
$self->routes->route('/:controller/:action')
$self->routes->get('/:controller/:action')
->over(headers => {Referer => qr/example\.com/});
# Mojolicious::Lite
plugin 'HeaderCondition';
get '/' => (headers => {Referer => qr/example\.com/}) => sub {...};
# All headers need to match
$self->routes->route('/:controller/:action')->over(headers => {
$self->routes->get('/:controller/:action')->over(headers => {
'X-Secret-Header' => 'Foo',
Referer => qr/example\.com/
});
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Routes/Match.pm
Expand Up @@ -166,11 +166,11 @@ Mojolicious::Routes::Match - Routes visitor
# Routes
my $r = Mojolicious::Routes->new;
$r->route('/foo')->to(action => 'foo');
$r->route('/bar')->to(action => 'bar');
$r->get('/foo')->to(action => 'foo');
$r->put('/bar')->to(action => 'bar');
# Match
my $m = Mojolicious::Routes::Match->new(GET => '/bar');
my $m = Mojolicious::Routes::Match->new(PUT => '/bar');
$m->match($r);
say $m->captures->{action};
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojolicious/Routes/Route.pm
Expand Up @@ -380,8 +380,8 @@ also the L<Mojolicious::Lite> tutorial for more argument variations.
Add a new bridge to this route as a nested child.
my $auth = $r->bridge('/user')->to('user#auth');
$auth->route('/show')->to('#show');
$auth->route('/create')->to('#create');
$auth->get('/show')->to('#show');
$auth->post('/create')->to('#create');
=head2 C<delete>
Expand Down Expand Up @@ -485,7 +485,7 @@ L<Mojolicious::Lite> tutorial for more argument variations.
Activate conditions for this route. Note that this automatically disables the
routing cache, since conditions are too complex for caching.
$r->route('/foo')->over(host => qr/mojolicio\.us/)->to('foo#bar');
$r->get('/foo')->over(host => qr/mojolicio\.us/)->to('foo#bar');
=head2 C<parse>
Expand Down Expand Up @@ -594,7 +594,7 @@ restrictions.
Add a waypoint to this route as nested child.
my $foo = $r->waypoint('/foo')->to('example#foo');
$foo->route('/bar')->to('#bar');
$foo->get('/bar')->to('#bar');
=head2 C<websocket>
Expand Down

0 comments on commit 9f55349

Please sign in to comment.