[web-devel] More power, more configurable subsites

Michael Snoyman michael at snoyman.com
Sat Jan 22 17:29:38 CET 2011


On Fri, Jan 21, 2011 at 11:25 PM, Matt Brown <matt at softmechanics.net> wrote:
> Michael,
>
> This all sounds great, especially the ability to use WAI apps as
> subsites.  Would this also mean yesod sites could be deployed as
> subsites, since they're converted to WAI apps?

Yes, with a few caveats:

* The parent Yesod app will not be able to use the child app's type-safe URLs.
* There will be no automatic approot support like there is for proper
subsites, since each application will have its own Yesod instance.
* Likewise, there will be no defaultLayout sharing, or for that matter
any other settings contained in the Yesod typeclass.

> I don't see any major problems between the proposed routing changes
> and the existing subsite implementation.  My patch for dynamic
> subsites allows routes to subsites to contain dynamic pieces, but as
> long as the subsite dispatch remains independent of parsing the route
> to the subsite, that detail should be transparent.
>
> If I understand correctly, the new dispatch process would look like:
> 1) identify the subsite / parse the route to the subsite
> 2) global site preparation
> 3) dispatch to the subsite
> 3a) identify the subsite handler / parse the route
> 3b) subsite preparation
> 3c) dispatch to the subsite handler
>
> I put the preparation steps after identification, so that preparation
> could be run within the handler (with handlerRoute set).  Is that what
> you had in mind?

That's basically it, but I'm not sure what you mean by "global site
preparation." The idea here is to do as little as possible before
dispatching to the subsite, that way if a subsite does not want to
deal with sessions, it doesn't involve that overhead.

Michael



More information about the web-devel mailing list