trailing ? doesn't work correctly.
jonathanong opened this issue · 4 comments
jonathanong commented
trailing ? doesn't work correctly.
avnersorek commented
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
nervgh commented
@avnersorek How do your code snippets correlate with the "trailing" problem?
avnersorek commented
@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 ?
nervgh commented
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.