@coool/route-node
v1.1.1
Published
Utilities for easy route node definitions.
Downloads
6
Maintainers
Readme
@coool/route-node
Utilities for easy route node definitions.
Install
$ npm i --save @coool/route-node
Usage
Define routes
export const RouteLocations = {
Home: new RouteNode('', {
queryParams: {
Stay: 'stay',
},
}),
Dashboard: new RouteNode('dashboard', {
children: {
Items: new RouteNode('items/:itemId', {
params: {
'itemId': 'itemId',
}
}),
},
}),
};
Use routes
@Get(RouteLocations.Dashboard.children.Items)
public async getItems(
@Param(RouteLocations.Dashboard.children.Items.params.itemId) itemId: string,
) {
// ...
}