[Dancer-users] Plack Middleware for subdomains
Matthew Vickers
mvickers at quispiam.com
Sun Feb 13 20:52:30 CET 2011
On 13/02/11 10:54 PM, Harshal Shah wrote:
> Hey Matt
>
> Thanks for the work... As for ticket 284, I was trying to host
> multiple tiny dancer apps, sharing a core functionality. Can we take
> this module further and do something like
>
> package Domain1App
>
> prefix_domain 'domain1' ;
>
> ## domain 1 specific routes
>
> package Domain2App
>
> prefix_domain 'domain2' ;
>
> ## domain 2 specific routes
>
> still running as single dancer app ? Though i cant think of a way to
> handle different config files for each of them ?
>
>
>
> Harshal Shah
>
Hi Harshal,
I am not sure, do you think the following would work ?
package Domain1App
if(request->env->{ 'domain1' }){
## domain 1 specific routes
}
package Domain2App
if(request->env->{ 'domain2'}) {
## domain 2 specific routes
}
If that works can a helper function like the following be written ?
Something similar to the prefix function ?
It would probably have to be a plugin as this sort of functionality is
probably not desired in core
sub subdomain {
my $subdomain = shift;
...
}
Matt
More information about the Dancer-users
mailing list