How do I mount a Dancer2 app tree with Plack::Builder?
I followed this tutorial http://advent.perldancer.org/2012/7 and built a very small but structured Dancer2 application. Now I would like to mount it as a PSGI application with Plack::Builder. What do I have to do? This here app.psgi configuration definitely doesn't work: https://metacpan.org/module/SUKRIA/Dancer2-0.02/lib/Dancer2/Deployment.pod#R... (it was probably built for Dancer1) Thank you
Nice catch, will look into that. Thanks -- Alexis, on the road Le 1 mars 2013 à 04:58, Punter <punter@punter.gr> a écrit :
I followed this tutorial http://advent.perldancer.org/2012/7 and built a very small but structured Dancer2 application.
Now I would like to mount it as a PSGI application with Plack::Builder. What do I have to do?
This here app.psgi configuration definitely doesn't work: https://metacpan.org/module/SUKRIA/Dancer2-0.02/lib/Dancer2/Deployment.pod#R... (it was probably built for Dancer1)
Thank you _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
http://paste.perldancer.org/2oyY93tJtTUss The above code will make the server respond to both /app1 and to /app2, but the response in both paths will be exactly the same... as if both ChatTo classes are present and loaded in both mounted apps. So, not good... (yet). Please advise/help... --- code from paste.perldancer.org is: # app.psgi: use Plack::Builder; use Dancer2; builder { mount '/app1' => builder { load_app 'ChatTo'; dance; }; mount '/app2' => builder { load_app 'ChatTo2'; dance; }; }; ############# # ChatTo.pm: package ChatTo; use Dancer2; get '/' => sub{ 'hi there'; }; 1; ############# # ChatTo2.pm: package ChatTo2; use Dancer2; get '/' => sub{ 'hi there 2'; }; 1; On 03/01/2013 05:58 AM, Punter wrote:
I followed this tutorial http://advent.perldancer.org/2012/7 and built a very small but structured Dancer2 application.
Now I would like to mount it as a PSGI application with Plack::Builder. What do I have to do?
This here app.psgi configuration definitely doesn't work: https://metacpan.org/module/SUKRIA/Dancer2-0.02/lib/Dancer2/Deployment.pod#R... (it was probably built for Dancer1)
Thank you
Allow me to present to you my first attempt at making Dancer2 compatible with Plack::Builder. That is, allowing multiple Dancer2 apps to be mounted with Plack::Builder: https://github.com/akarelas/Dancer2/commit/8bb4e37365eccc8e4f6dfa388d4dccf5e... The above modification (a *very few* lines of code) make Plack::Builder able to mount two web different webapps, for example take a look at these 2 minimalistic web apps: http://paste.perldancer.org/3272qupgjyQIq It works, until you set both web app classes to "use" a common class with another (common between them) route. Then only the first web app will load it. Which is not good. - Punter
participants (2)
-
Alexis Sukrieh -
Punter