Class: Router

Marbles. Router

new Router()

Source:
See:
Example
var MyRouter = Marbles.Router.createClass({
	displayName: "MyRouter",

	// routes are evaluated in the order they are defined
	routes: [
		{ path: "posts", handler: "posts" },

		// :id will be available in the params
		{ path: "posts/:id", handler: "posts" },

		// * will be available in the params as `splat`
		{ path: "posts/:id/*", handler: "posts" },
	],

	beforeHandler: function (event) { // optional before hook
		// same as handler:before event sent through dispatcher
		// but only called for the router the handler belongs to
		// and called before event is sent through dispatcher
	},

	posts: function (params, opts) {
		// params is an array of objects,
		// params[0] should be all you need unless
		// you have multiple params of the same name

		// opts contains any extra properties given in a route object
	}
});
new MyRouter(); // bring it to life