I feel like the core Plugin Mount would best address your objectives. I've built a router app based entirely on Mount that simply makes other apps available within their respective url name spaces.
Hopefully that's what you're looking for! On Sep 22, 2014 10:34 PM, "Luc Didry" <[email protected]> wrote: > Hello, > > I want to make my application installable in URL subdirectories (ie > http://example.com/myapp/) > > So I followed the Cookbook > (http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Rewriting) and > added this in the before_dispatch hook : > push @{$c->req->url->base->path->trailing_slash(1)}, > shift @{$c->req->url->path->leading_slash(0)}; > > That works well, except for one thing : url_for('/') returns "/myapp" > instead of "/myapp/" > > This is a real problem for me as I use url_for('/') in javascript > templates. For example : > function (foo) { > return '<%= url_for('/') %>'+foo; > } > > So, this function, which returns '/foo' if I don't have the hook, > returns '/myappfoo' instead of '/myapp/foo'. > > Is this a bug, or did I something wrong ? > > Second question : is there a way to determine if we are in a > subdirectory ? If not, I will just let the user say it in the > configuration file. > > Thank you > -- > Luc > http://www.fiat-tux.fr/ > Internet n'est pas compliqué, Internet est ce que vous en faites. > > -- 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 http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
