I’d like to be able to accepts URL paths using the backbone.js routing system, to interpret before navigating. Ideally, I will be able to set up a single route, or a series of a few routes that can be used in understanding all possibilities.
For example, these are possible URLs
mysite.com/books/war_and_peace.12.b
mysite.com/books/philosophy/war_and_peace.12.b
mysite.com/russian/books/philosophy/war_and_peace.12.b
mysite.com/philosophy/the_brothers_karamozov.68.b
mysite.com/crime_and_punishment.44.b
Ideally, I want to write a ‘route’ that accepts n parameters, and can then use logic to sort out the query and how to navigate.
This is what I have so far, yet isn’t cutting it:
this.route(':p1/:p2/:p3/:p4/:p5/:p6/:p7', 'home', function(p1, p2, p3, p4, p5, p6, p7) {
// do stuff
});
Use a wildcard.