This Description describes non-index routes that are used by routesFromObject to build the RouteObjects for the UI.
Optionalaction?: "api"Optionalchildren?: RouteDescription[]Child routes for this route.
Optionalcomponent?: RouteComponentDescriptionComponent to use for this route.
Optionalhandle?: RouteHandleDescriptionArbitrary data for this route.
Optionalhydrate?: "loader"Component to use for hydration.
Optionalid?: stringid to use for this route.
Optionalloader?: RoutePageLoaderDescriptionLoader to use for this route. Only specify a loader if there is data that must be fetched.
Optionalpath?: stringThe value that you use here is dependent upon how you are building your routes. If you are nesting routes, then the value here will be a single part of the url.
i.e. full-url=/some/path/here for the parent route,
this value would be set to some.
This value can also be setup to be dynamic. To do this prefix the name of the dynamic path you wish to use for this route with a colin ":".
i.e. full-url=/some/path/here if you wanted the parent route to be
dynamic with a name of "section", this value would be set to
:section.
Optionalrevalidate?: booleanShould the loader data be re-validated on a navigation event.
This Description describes index routes that are used by routesFromObject to build the RouteObjects for the UI.
Optionalaction?: "api"Optionalcomponent?: RouteComponentDescriptionComponent to use for this route.
Optionalhandle?: RouteHandleDescriptionArbitrary data for this route.
Optionalhydrate?: "loader"Component to use for hydration.
Optionalid?: stringid to use for this route.
Is this route an index route? This value must always be set to true
Optionalloader?: RoutePageLoaderDescriptionLoader to use for this route. Only specify a loader if there is data that must be fetched.
Optionalrevalidate?: booleanShould the loader data be re-validated on a navigation event.
A basic json description for a simple routing structure.
[
{
"id": "root",
"path": "/",
"revalidate": false,
"hydrate": "loader",
"children": [
{
"path": ":module",
"children": [
{
"path": ":model",
"action": "api",
"children": [
{
"index": true,
"component": "list",
"loader": "django"
},
{
"path": ":pk",
"component": "detail",
"action": "api",
"loader": "django"
}
]
}
]
}
]
}
]
This example covers the following:
id root is the base path to the site. /
All paths are dynamic.
Navigation structure of:
/:module/:model
/:module/:model/:pk
A colin ':' prefixed to a path denotes that the route is dynamic. What
ever value is actually used there will be passed directly to the backend.
For example, if you navigated to /accounting/assets, which is an index
route with list as its component. This means that the path would show
the dataset on this path.
Like wise navigating to /accounting/assets/45 which is the route with
detail as its component. This means that the path would show an
object. In this case an asset with an id/pk of 45
would be what is viewed.
When describing your routes, only specify what is required. Using the
example above, you will only see a loader specified twice. This is because
where it has been specified is where data must be obtained from the
specified backend. In this case Django.
It is possible to specify an additional backend and routes. However for this they must be specified as child of Root Routes.
[
{
"id": "root",
"path": "/",
"revalidate": false,
"hydrate": "loader",
"children": [
{
"id": "centurion_erp",
"path": "centurion_erp",
"handle": {
"backend_url": "https://my-backend.tld/api/v2"
}
}
]
}
]
In this example, path /centurion_erp has no children. However what will
occur since handle.backend_url has been specified, a
apiRootMetadata request will be made to fetch the routes that will
be added as children.
This object describes the routes so that the UI can setup the routes dynamically. Routes are provided by a backend.
The initial fetching of this object is done via a apiRootMetadata request to the UIEnvironment.API_URL. Any subsequent requests for further routes, will use the url provided as part of the route via RouteHandleDescription.backend_url. See below for examples.