How do I set up a Backbone router that can handle URLs such as:
example.com/#!/story-1/?a=1&b=2
or preferably with sub-page URL support:
example.com/#!/chapter-1/story-1/?a=1&b=2
I basically want a simple way to define pages with an associated query string.
Is this supported by default or should I make use of this or other addition?
https://github.com/documentcloud/backbone/pull/668
The end result should be something like:
-
Requested resource:
example.com/#!/chapter-1/story-1/?a=1&b=2 -
Parse and see if it matches page in pages object:
pages : {
chapter-1_story-1 : {
template : #template1
}
} -
Load page template and page controllers with query string:
PageController.load(template, params)
From the docs:
So therefore you can use variables like this:
or paths like this:
I am not aware of any query string handling however.