Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Created July 25, 2013 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliangruber/6077347 to your computer and use it in GitHub Desktop.
Save juliangruber/6077347 to your computer and use it in GitHub Desktop.
var router = require('client-router');
router(function (match, href) {
if (match('/')) {
// home page
}
if (match('/posts/:id/:comments?')) {
var id = match.params.id;
var comments = !! match.params.comments;
// post page
}
});
// go to a page
router.go('/posts/3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment