Function
createMiddlewareFromRoute
({
path,
handler,
method
}: MethodHandler<Req, Res> & {
method?: Method
})
Source from the content-addressed store, hash-verified
| 107 | /** HELPER METHODS */ |
| 108 | |
| 109 | const createMiddlewareFromRoute = <Req extends any = any, Res extends any = any>({ |
| 110 | path, |
| 111 | handler, |
| 112 | method |
| 113 | }: MethodHandler<Req, Res> & { |
| 114 | method?: Method |
| 115 | }) => ({ |
| 116 | method, |
| 117 | handler: handler || (path as Handler), |
| 118 | path: typeof path === 'string' ? path : '/' |
| 119 | }) |
| 120 | |
| 121 | /** |
| 122 | * Push wares to a middleware array |
Tested by
no test coverage detected