https://github.com/hacklone/coool-route-node
Utilities for route nodes
https://github.com/hacklone/coool-route-node
Last synced: about 2 months ago
JSON representation
Utilities for route nodes
- Host: GitHub
- URL: https://github.com/hacklone/coool-route-node
- Owner: Hacklone
- License: mit
- Created: 2024-01-20T11:18:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T15:00:00.000Z (over 2 years ago)
- Last Synced: 2024-04-29T10:20:28.273Z (about 2 years ago)
- Language: TypeScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @coool/route-node
Utilities for easy route node definitions.
## Install
```shell script
$ npm i --save @coool/route-node
```
## Usage
### Define routes
```typescript
export const RouteLocations = {
Home: new RouteNode('', {
queryParams: {
Stay: 'stay',
},
}),
Dashboard: new RouteNode('dashboard', {
Items: new RouteNode('items/:itemId', undefined, {
params: {
'itemId': 'itemId',
},
}),
}),
};
```
### Use routes
```typescript
@Get(RouteLocations.Dashboard.children.Items)
public async getItems(
@Param(RouteLocations.Dashboard.children.Items.params.itemId) itemId: string,
) {
// ...
}
```