An open API service indexing awesome lists of open source software.

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

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,
) {
// ...
}
```