I’m building a site using Express and Backbone.js. I’d like to handle as much as I can on the front-end.
One thing that I’m confused about, is how to defer routing requests to Backbone rather than Express. I understand that Backbone can now handle routes such as ‘/this/here’, but of course Express interprets that first.
What’s the best way to hand that off to Backbone? Should I create a global route in Express that handles everything I don’t specifically define?
i may be completely mistaken but express is a server-side framework while backbone is a client-side framework.
only server-side frameworks are responsible for routing in the sense of analyzing incoming requests and delivering resources.
i think, what you are refering to is resource routing (coming out of the ruby on rails world) support inside express, that is, every resource in your application is available at a restful url like
/posts.you can than GET, POST, PUT, DELETE this resource and the framework dispatches those types right to the correct business logic.
routes in backbone.js are (as of my understanding) pure client-side routes which enable you to have a working browser history while building a full-fledged ajax application.
i hope it got clear that both things, although named the same, are not exactly the same.