ModelN/backbone.subroute — pull request #34 by maoueh (2014-03-21 20:52:30+00:00)
Title: Enable possibility to pass an empty prefix

This feature could be used to create a main router that delegates unmatched paths to a "global" router. The main router would then only contains sub router definitions. I put an example usage at the bottom.

Tell me if it's something you would accept. Maybe there is already a better idea to achieve this. Sorry in advance for any missing things, first time I contribute to a JavaScript project :)

Example Usage:

```javascript
var Router = Backbone.Router.extend({
routes: {
// Sub paths
"projects/*subroute" : "routeProjects",

// Fallback to MainRouter
"*subroute" : "routeMain",
},

routeMain : function (subroute) {
if (!App.Routers.Main) {
App.Routers.Main = new MainRouter("");
}
},

routeProjects : function (subroute) {
if (!App.Routers.Projects) {
App.Routers.Projects = new ProjectsRouter("projects");
}
}
});
```

Regards,
Matt