Skip to content

Instantly share code, notes, and snippets.

@yko
Created June 24, 2011 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yko/1045160 to your computer and use it in GitHub Desktop.
Save yko/1045160 to your computer and use it in GitHub Desktop.
package Foo;
use Mojo::Base 'Mojolicious';
# This method will run once at server start
sub startup {
my $self = shift;
# Routes
my $r = $self->routes;
# Normal route to controller
my $foo = $r->route('/api')->to('bar#baz', namespace => 'Example');
$foo->route('/nested')->to('bar#nested');
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment