by STRML · 13y ago · 0 comments
I have had some luck with Backbone.routes (http://siong1987.com/posts/introducting-backbone-routes/) but it is still not quite where I want it to be.
The app is basically one big REST endpoint, but it does some header sniffing to handle requests with a "text/html" Content-Type. If it encounters one, the request to the still goes through and returns JSON, but that response is then injected as a preloaded datastore into the template being rendered. This bypasses the whole double load scenario that Twitter once was. Discourse is a great example of this in action, just have a look at the view-source://