MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / handle

Method handle

packages/rest/src/sequence.ts:117–135  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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/**

Callers

nothing calls this directly

Calls 4

parseParamsMethod · 0.80
rejectMethod · 0.80
describeMethod · 0.65
findRouteMethod · 0.45

Tested by

no test coverage detected