Created
March 23, 2010 13:19
-
-
Save sharifulin/341151 to your computer and use it in GitHub Desktop.
Mojolicious routes in my real app
This file contains hidden or 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
# check routes: script/app routes | |
my $r = $self->routes; | |
$r->route("/$_")->to("user-auth#$_") for qw(login signup forgot); | |
# check user | |
for($r->bridge->to('user-auth#check')) { | |
$_->route('/')->to('about#index'); | |
$_->route('/movies')->to('movie#main'); | |
$_->route('/movie/:name')->to('movie#one'); | |
$_->route('/distributor/:name')->to('distributor#one'); | |
$_->route('/contact')->to('contact#main'); | |
$_->route('/:name', name => qr/about|cinema/)->to('about#static'); | |
# check USER | |
for($_->bridge->to('user-auth#check_user')) { | |
$_->route('/upload' )->to('upload#main'); | |
$_->route('/custom' )->to('custom#main'); | |
$_->route('/profile')->to('user-auth#profile'); | |
$_->route('/logout' )->to('user-auth#logout'); | |
} | |
} | |
# admin | |
$r->route('/admin')->to('admin-movie#list'); | |
for (qw(movie distributor user contact trailer custom mail upload)) { | |
$r->route("/admin/$_")->to("admin-$_#list"); | |
$r->route("/admin/$_/hidden")->to("admin-$_#list", hidden => 1); | |
$r->route("/admin/$_/add" )->to("admin-$_#add"); | |
$r->route("/admin/$_/sort")->to("admin-$_#sort"); | |
$r->route("/admin/$_/:id", id => qr/\d+/)->to("admin-$_#one"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment