[dancer-users] My attempt to load 2 apps in one PSGI server:

Punter punter at punter.gr
Fri Mar 1 16:30:28 GMT 2013


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#Running-multiple-apps-with-Plack::Builder 
> (it was probably built for Dancer1)
>
> Thank you



More information about the dancer-users mailing list