Sammy actually threw the ball when it came to optional parameters and requests. The only way I could work well is to use regular expressions and a splat object. In your example, you should write:
this.get(/\#\/route\/(.*)\/(.*)/, function (context) { var result = this.params['splat']; });
The downside is that you need a backslash at the end of the url when the optional parameter is omitted.
The splat object is the actual result of the JavaScript mapping method and is an array .
'#/route/test/' => {result[0]: 'test', result[1]: ''} '#/route/test/chicken' => {result[0]: 'test', result[1]: 'chicken'}
source share