Skip to content

Type Alias: Executor()<MiddlewareFn>

ts
type Executor<MiddlewareFn> = (
  middleware: MiddlewareFn,
  next: NextFn,
) => Promise<any>;

The executor function responsible for invoking each middleware handler.

The executor gives you control over how middleware functions are called, allowing you to pass custom context and parameters to each handler.

Type Parameters

Type ParameterDescription
MiddlewareFn extends anyThe type of the middleware function/handler

Parameters

ParameterTypeDescription
middlewareMiddlewareFnThe current middleware handler to execute
nextNextFnThe next function to advance the pipeline

Returns

Promise<any>