MCPcopy Index your code
hub / github.com/oakserver/oak / MiddlewareObject

Interface MiddlewareObject

middleware.ts:32–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30/** Middleware objects allow encapsulation of middleware along with the ability
31 * to initialize the middleware upon listen. */
32export interface MiddlewareObject<
33 S extends State = Record<string, any>,
34 T extends Context<S> = Context<S>,
35> {
36 /** Optional function for delayed initialization which will be called when
37 * the application starts listening. */
38 init?: () => Promise<unknown> | unknown;
39 /** The method to be called to handle the request. */
40 handleRequest(context: T, next: Next): Promise<unknown> | unknown;
41}
42
43/** Type that represents {@linkcode Middleware} or
44 * {@linkcode MiddlewareObject}. */

Callers

nothing calls this directly

Implementers 3

MockMiddlewareObjectmiddleware.test.ts
CountingMiddlewareexamples/countingServer.ts
LoggerMiddlewareexamples/countingServer.ts

Calls

no outgoing calls

Tested by

no test coverage detected