andreypopp/react-app-middleware — pull request #4 by natew (2014-02-07 04:39:09+00:00)
Title: Making modifications to allow for passing in a root node / layout

This is a little hacky at the moment but is working for me in [this app skeleton](http://github.com/natew/reactor).

The problem is this: jsx/React don't support all of the HTML spec for probably good reason. Common, important like doctypes and conditional comments for IE. This is a limiting factor when building out a server based app with your great middlware/controller + React.

This request allows you to pass in two new options:

- root: Pass in a querySelector to specify the root node to render to.
- layout: Pass in a string to be used as the layout, with `{{yield}}` being replaced by react-app-middleware with the rendered components.

I'm opening this more to show feasibility, I haven't spent time yet to rethink better design, just did what worked for now. My thoughts are that maybe allowing this middleware to be more flexible and not close out the response would allow for devs to implement this logic in their own server code, but I am still fairly new to node/express. Would love to hear your thoughts.