[Dancer-users] Plack Middleware for subdomains

Harshal Shah harshal.shah at gmail.com
Sun Feb 13 12:54:27 CET 2011


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


On Sun, Feb 13, 2011 at 4:01 PM, Matthew Vickers <mvickers at quispiam.com>wrote:

>  Hey sawyer,
>
> Thanks for the wow !
>
> I am not very plack literate but I do not think this middleware would suit
> ticket 284.  It seems that harshalls wants to mount different apps at
> different subdomains.  All Dancer::Middleware::Subdomain does is set $env->{
> SUBDOMAIN } to the subdomain, I use it so that I can map an account to a sub
> domain ala freshbooks.
>
> Can logic be placed in the builder block ?
>
> builder {
>     if($env->{ SUBDOMAIN } eq 'foo')
>     {
>         mount ...
>     }
>     if($env->{ SUBDOMAIN } eq 'bar')
>     {
>         mount ...
>     }
> }
>
> Perhaps someone with more perl/Dancer foo than I can hack it to fix the
> issue.
>
> Matt
>
>
> On 13/02/11 8:54 PM, sawyer x wrote:
>
> Wow!
>
> I think this will prove itself very useful, and we already have a ticket of
> a person who needs exactly this behavior (GH #248).
>
> Do you think that ticket can be handled by Dancer::Middleware::Subdomain?
>
> On Sun, Feb 13, 2011 at 6:29 AM, Matthew Vickers <mvickers at quispiam.com>wrote:
>
>> Hi all,
>>
>> I have a need for the use of subdomains being mapped to accounts and could
>> not find a plugin or middleware already written, so I have whipped up a
>> Dancer::Middleware::Subdomain library and have it up on github.
>>
>> https://github.com/mvickers/dancer_middleware_subdomain
>>
>> Comments/Criticisms are welcome.
>>
>> Matt
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>>
>
>
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110213/fd602c55/attachment.htm>


More information about the Dancer-users mailing list