Type Alias MiddlewareArgs<TParameters, TReturn>

MiddlewareArgs: {
    args: TParameters;
    context: IContext;
    next: NextFn<TParameters, TReturn>;
}

Arguments passed to middleware functions during execution.

Contains the original function arguments, a reference to the next middleware in the chain, and the execution context for accessing and modifying state.

Type Parameters

  • TParameters extends unknown[] = unknown[]

    Type of arguments passed to the function

  • TReturn = unknown

    Type of value returned from the function

Type declaration

const loggingMiddleware: MiddlewareFn = ({ args, next, context }) => {
console.log('Before:', args);
const result = next(args);
console.log('After:', result);
return result;
};

IMPORT_PATH: @daiso-tech/core/middleware