Reusing backbone views/routes on the server when using Backbone.js pushstate for seo/bookmarking

前端 未结 2 1702
一生所求
一生所求 2020-12-15 11:29

I\'m doing some due diligence on backbone for a single page app and wonder if it is possible to re-use the same views/routes from the client on the server side, so that when

相关标签:
2条回答
  • 2020-12-15 11:44

    This project does exactly what you are trying to do. It might interest you to check it out. https://github.com/developmentseed/bones

    0 讨论(0)
  • 2020-12-15 12:08

    I haven't tried this yet but these ideas using node.js and backbone might help:

    http://andyet.net/blog/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/

    http://bennolan.com/2010/08/13/pushstate-and-nodejs.html

    Basically the only way to make it so your not writing the same thing twice is to have both your node.js server and frontend client share the same routing/model code. If you are using something else on the server side (like Ruby) you would have to place node.js in front of your app server. Then make node.js proxy for new clients (push state and client js) and do actually rendering work for old/bot clients.

    The other option is doing what jQuery Mobile does which is the Hijax method. The idea to make tons of HTML5 pages (you'll have to look at its routing to see).

    And for completeness you should be aware of how google crawls AJAX: http://code.google.com/web/ajaxcrawling/docs/getting-started.html

    0 讨论(0)
提交回复
热议问题