Created
July 25, 2013 06:30
-
-
Save juliangruber/6077347 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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