pillarjs/routington

trailing ? doesn't work correctly.

jonathanong opened this issue · 4 comments

trailing ? doesn't work correctly.

Works:

var routington = require('routington');
var router = routington();
var match = null;

router.define('/v1/shoes/:shoeId/laces');
router.define('/v1/shoes/:shoeId/socks');

match = router.match('/v1/shoes/123/socks'); // returns the correct node

Does not work:

var routington = require('routington');
var router = routington();
var match = null;

router.define('/v1/shoes/:shoeId/laces');
router.define('/v1/shoes/:differentParamName/socks');

match = router.match('/v1/shoes/123/socks'); // returns null

@avnersorek How do your code snippets correlate with the "trailing" problem?

@nervgh Suddenly noticed this issue only had a title :D
My problem is with a path variable which is followed by another text part - so it's "trailing" the path.
I guess this issue means something else ?

I'm closing this issue because I think the handling of trailing slashes with routington is not so bad. If you need the same behavior for /foo and /foo/ urls then just add koa-no-trailing-slash on the top of the middleware queue.