Routing issues #178

taomin opened this Issue Jun 1, 2012 · 3 comments


None yet

3 participants

taomin commented Jun 1, 2012

Hi I ran into an issue in routes.json. I want to hear you guys opinion before I started investigate / patching it

I have a use case for below urls:

route 1 : "/blogpost_:blogpost"
route 2 : "/:article"

What I want to do is, when a url comes, first check whether the url has a "blogpost_" prefix, if no, use the "/:article" rule.

I've tested this scenario in mojito. When I try url like "/blogpost_xxx.html", it just goes to "/:article" route.

Is this expected ?

I haven't look into how ac.url generate the regular expression for parsing it. But do you guys feel this is a valid use case and worth a patch for fixing it ? I can work on this if you guys agreed.

Furthermore, express framework support some formats like


2 variables in a /.../ region. Does mojito have plan to support thing like this ? It will be useful too.

caridy commented Jan 29, 2013

@drewfish isn't this a case for a custom regex? Can you comment and close?


Looking in lib/app/autoload/route-maker.common.js it looks like the default regex for :token matches is [^/]+ so I'm surprised it didn't work for you. Given that, I suspect that a custom regex won't help (though it's worth a try).

caridy commented Mar 3, 2014

This should be solved in mojito-next (0.9) which is using express 3.x routes.

@caridy caridy closed this Mar 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment