5

I have a web app whose current structure is to render everything in the browser with backbone.js and client-side templates, pulling all dynamic content from a Python-powered JSON API. Some of the app is content-y enough that I wouldn't mind serving it up to Google and supporting non-JS clients, so I've been mulling moving to an architecture where the first request gets handled by a Node app that renders the first page and serves it rendered, after which point Backbone will take over on the client if JS is enabled to render subsequent requests as they work now.

I'm aware of a couple of efforts (like Development Seed's bones) to implement just this kind of strategy, but they seem to expect an app that was planned up-front with their use in mind, which, for better or for worse, mine wasn't.

I'm looking for tools, libraries, etc., that would make this transition easier. Bonus points if it's practical to offer slightly-different experiences in some areas for non-JS clients. Thoughts?

Andrew Pendleton
  • 761
  • 5
  • 13
  • On the very basic level Node.js will render anything using built-in Jade templating engine (which is super handy, IMO). I don't understand what's the issue with combining client side rendering. Your app needs to render at least something, at least `` where you will include JS files, etc. – mvbl fst Aug 28 '12 at 01:35
  • Right, basically at the moment when you request "/" (or anything else that isn't an API endpoint), you get a page with a with scripts in it and an empty body, and the backbone router figures out what to display, grabs it via the API, and renders the body on the client. I'd like to take that existing routing/rendering infrastructure and move to the server so that the initial request gets a body that's already populated, and I'm wondering if there are libraries that make that easier. – Andrew Pendleton Aug 28 '12 at 17:59

1 Answers1

2

Airbnb had a good article about this. I imagine this space will progress pretty quickly over the next few months.

http://nerds.airbnb.com/weve-launched-our-first-nodejs-app-to-product

philfreo
  • 41,941
  • 26
  • 128
  • 141