Closed agentgt closed 12 years ago
In the current 0.8.x version there is no support for wildcard route matching, however I have already added it to what will become version 0.9.x in the next branch.
It could change an any time yet but currently the api looks like this:
this.get('/welcome/*name', function () {
console.log(req.params['name'])
})
As you would expect this will match the following:
/welcome/foo
/welcome/foo/bar/baz
If all goes well I should be able to put together a release next week.
Is it possible to do something like this
this.get('/pages/[this-can-be-one-slug/or-maybe-two/or-as-many-as-i-like]/edit', function (req) {
alert('Editing: ' + req.params[the slugs]);
})
@kloojed that would work because the string gets turned into a regex. The new release will have support for this, I'm hoping to get a release out early next week, travelling has delayed it a little,
Added in version 0.9.0
Ah, luckily Google led me to this page. Could you put these feature in the documentation?
Good call, I'll get this added to the site and api docs, thanks for bring it to my attention
on 0.99, how do I name and access the second segment?
'/page/[one/two/three]/:somevalue'
i've tried
'/page/[one/two/three]:thing/:somevalue' '/page/([one/two/three]):thing/:somevalue'
etc...
From what I gather is no wild card path support right? In other words you can't do something like the following:.
"**" in this case means all paths and subpaths underneath '/wecome/' an example implementation in Java is here: http://static.springsource.org/spring-security/site/docs/3.1.x/apidocs/org/springframework/security/web/util/AntPathRequestMatcher.html