Function
| Static Public Summary | ||
| public |
createRest(creator: function(r: Maker): null): RestRoutes Create routes by sync callback |
|
| public |
flattenRoutes(routes: RestRoutes): object Convert original deep routes to flat object |
|
| public |
isCreateRestInstance(routes: RestRoutes): boolean Check is correct routes passed |
since 0.7.0 |
| public |
printRoutes(routes: RestRoutes, realPrint: boolean): string[] Print routes to console and string |
|
Static Public
public createRest(creator: function(r: Maker): null): RestRoutes source
import {createRest} from 'createrest/lib'Create routes by sync callback
public flattenRoutes(routes: RestRoutes): object source
import {flattenRoutes} from 'createrest/lib/flatten'Convert original deep routes to flat object
Params:
| Name | Type | Attribute | Description |
| routes | RestRoutes | Original routes from |
Example:
const handler = () => {}
const routes = createRest(r => { r.get('foo', handler) })
const flatRoutes = flattenRoutes(routes)
test.deepEqual(
flatRoutes,
{
'/foo/': {
GET: [handler],
},
},
)
public isCreateRestInstance(routes: RestRoutes): boolean since 0.7.0 source
import {isCreateRestInstance} from 'createrest/lib'Check is correct routes passed
Params:
| Name | Type | Attribute | Description |
| routes | RestRoutes |
public printRoutes(routes: RestRoutes, realPrint: boolean): string[] source
import {printRoutes} from 'createrest/lib/printer'Print routes to console and string
Params:
| Name | Type | Attribute | Description |
| routes | RestRoutes | ||
| realPrint | boolean |
