New feature: wildcard :*
routes
Description
Added special wildcard param ":*", can be followed by named params, or other sub-path, or left as the rightmost param to match all.
First matching route wins, so they should be ordered from the most specific to the least specific in case of overlap
For this list of routes:
[
'/',
'/foo',
'/foo/:*/:something/more',
'/foo/:*/:something',
'/foo/:*',
'/bar/:*',
'/cleanHistory'
]
These matches will be found based on URL
http://localhost:8080/bar
{
"currentRoute": {
"route": "/bar/:*",
"regex": "^/bar(.*)/*$",
"params": {
"*": ""
}
}
}
http://localhost:8080/bar/
{
"currentRoute": {
"route": "/bar/:*",
"regex": "^/bar(.*)/*$",
"params": {
"*": ""
}
}
}
http://localhost:8080/bar/x/z
{
"currentRoute": {
"route": "/bar/:*",
"regex": "^/bar(.*)/*$",
"params": {
"*": "/x/z"
}
}
}
http://localhost:8080/foo
{
"currentRoute": {
"route": "/foo",
"regex": "^/foo/*$",
"params": {}
}
}
http://localhost:8080/foo/
{
"currentRoute": {
"route": "/foo",
"regex": "^/foo/*$",
"params": {}
}
}
http://localhost:8080/foo//////
{
"currentRoute": {
"route": "/foo",
"regex": "^/foo/*$",
"params": {}
}
}
http://localhost:8080/foo/x/z
{
"currentRoute": {
"route": "/foo/:*/:something",
"regex": "^/foo(.*)/([^/]+)/*$",
"params": {
"*": "/x",
"something": "z"
}
}
}
http://localhost:8080/foo/whatever
{
"currentRoute": {
"route": "/foo/:*",
"regex": "^/foo(.*)/*$",
"params": {
"*": "/whatever"
}
}
}
http://localhost:8080/foo/x/z/more
{
"currentRoute": {
"route": "/foo/:*/:something/more",
"regex": "^/foo(.*)/([^/]+)/more/*$",
"params": {
"*": "/x",
"something": "z"
}
}
}
http://localhost:8080/foo/x/z/more////
{
"currentRoute": {
"route": "/foo/:*/:something/more",
"regex": "^/foo(.*)/([^/]+)/more/*$",
"params": {
"*": "/x",
"something": "z"
}
}
}
http://localhost:8080/foo//////x/z/more
{
"currentRoute": {
"route": "/foo/:*/:something/more",
"regex": "^/foo(.*)/([^/]+)/more/*$",
"params": {
"*": "//////x",
"something": "z"
}
}
}