kriasoft/universal-router

Nested route snippet example not working

JoeGrasso opened this issue · 6 comments

How blessed difficult would it be to put a nested route in your starter kit. The snippet example you provide is too terse!

Could you explain what exactly is not working or what behavior are you expect?

One more example: https://jsfiddle.net/frenzzy/8rm2y4jg/

mbme commented

@frenzzy example doesn't work with universal-router@4.0.0 - can't select /posts or /posts/hello-world

mbme commented

many thanks! was not clear to me that inner path now should be empty :)

If you are using trailing slashes in your paths, then router will match urls only with trailing slashes, ie

path: '/posts'   // matches both "/posts" and "/posts/"
path: '/posts/'  // matches only "/posts/"
path: '/posts'  +  path: ''       =  path: '/posts'
path: '/posts'  +  path: '/'      =  path: '/posts/'
path: '/posts'  +  path: '/:id'   =  path: '/posts/:id'
path: '/posts'  +  path: '/:id/'  =  path: '/posts/:id/'

There is an example in README.md

Any suggestions how to make it cleaner for other people?

mbme commented

Docs are clear enough, that was just me - I didn't notice README updated after release

Thanks for the great library!