Last active
June 1, 2016 23:15
-
-
Save mattmazzola/23c4bc8c238b5f10aa3c804e476549cc to your computer and use it in GitHub Desktop.
Route Recognizer Wildcard Test
This file contains hidden or 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
let RouteRecognizer = require("route-recognizer"); | |
let router = new RouteRecognizer(); | |
router.add([{ path: '*path', handler: null }]); | |
router.add([{ path: '/report/pages', handler: null }]); | |
router.add([{ path: '/report/pages/:pageName', handler: null }]); | |
router.add([{ path: '/report/pages/:pageName/visuals/:visualId', handler: null }]); | |
let getPages = router.recognize('/report/pages'); | |
console.log('/report/pages: ', getPages); | |
let matches = router.recognize('/report/pages/page1'); | |
console.log('matches: ', matches); | |
let matches2 = router.recognize('/report/pages/page1/visuals/visual1'); | |
console.log('matches2: ', matches2); | |
let matches3 = router.recognize('abc123'); | |
console.log('matches3: ', matches3); | |
let matches4 = router.recognize('abc123/asdfasdf'); | |
console.log('abc123/asdfasdf: ', matches4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment