I have an authenticated part of my app, where I want all paths under 
"/app*" to go to the same action. I thought I could do this with only one 
route, but I seem to need two:

my $session_auth_route = $app->routes->under('/app' => sub ($c) {
    return 1 if $c->is_session_authenticated; 


    $c->redirect_to('/');
    return;
});


# without this, /app alone will not match
$session_auth_route->get('/')->to(controller => 'app', action => 'index');


# I thought this would cover /app and /app/whatever, but it only works when 
there is more after /app in the path
$session_auth_route->get('/*')->to(controller => 'app', action => 'index'); 

Is there a better way to get this working with only one route that will 
match everything under /app and including /app?

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to