Closed
Description
Enhancement
Package Version: 5.0
I want design a REST API {owner}/{project}/tree/{branch}/*
to view the folder structure.
|- root
|- folder1
|- folder2
|- folder3
|- file1
- use
{owner}/{project}/tree/{branch}
to getfolder1
- use
{owner}/{project}/tree/{branch}/folder1
to getfolder2
- use
{owner}/{project}/tree/{branch}/folder1/folder2
to getfolder3
It is similar to github's repo url.
Code
I use router config like below first
{
"path": "{owner}/{project}/tree/{branch}/{folderPathes}",
"outlet": "view-project-tree"
}
folderPathes
can be empty or null, 'folder1', 'folder1/folder2' which contains /
But the router can not switch '{owner}/{project}/tree/{branch}/folder1' to '{owner}/{project}/tree/{branch}/folder1/folder2'
may be here do a check
https://github.com/dojo/framework/blob/master/src/routing/Router.ts#L244
if (route.segments[segmentIndex] === undefined) {
type = 'partial';
break;
}
because route.segments
length is greater than params
length
So I expect to support wildcard like this
{
"path": "{owner}/{project}/tree/{branch}/*",
"outlet": "view-project-tree"
}
Expected behavior:
{
"path": "tree/*",
"outlet": "view-tree"
}
*
can be zero or more segments
- if view the root folder, then the path is
tree
, not include the ending/
- if view the second level, then the path is
tree/folder1
- if view the third level, then the path is
tree/folder1/folder2
- ...