* Runs the default sequence. Given a handler context (request and response), * running the sequence will produce a response or an error. * * Default sequence executes these steps * - Executes middleware for CORS, OpenAPI spec endpoints * - Finds the appropriate controller method, sw
(context: RequestContext)
| 115 | * per-request IoC container and more. |
| 116 | */ |
| 117 | async handle(context: RequestContext): Promise<void> { |
| 118 | try { |
| 119 | const {request, response} = context; |
| 120 | // Invoke registered Express middleware |
| 121 | const finished = await this.invokeMiddleware(context); |
| 122 | if (finished) { |
| 123 | // The response been produced by the middleware chain |
| 124 | return; |
| 125 | } |
| 126 | const route = this.findRoute(request); |
| 127 | const args = await this.parseParams(request, route); |
| 128 | const result = await this.invoke(route, args); |
| 129 | |
| 130 | debug('%s result -', route.describe(), result); |
| 131 | this.send(response, result); |
| 132 | } catch (error) { |
| 133 | this.reject(context, error); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /** |
nothing calls this directly
no test coverage detected