@coool/route-node
v2.0.0
Published
Utilities for easy route node definitions.
Downloads
108
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', {
Items: new RouteNode('items/:itemId', undefined, {
params: {
'itemId': 'itemId',
},
}),
}),
};
Use routes
@Get(RouteLocations.Dashboard.children.Items)
public async getItems(
@Param(RouteLocations.Dashboard.children.Items.params.itemId) itemId: string,
) {
// ...
}