Skip to content

Instantly share code, notes, and snippets.

@lcanady
Last active December 19, 2021 10:58
Show Gist options
  • Select an option

  • Save lcanady/4a619357894fff2db4151307bcae6193 to your computer and use it in GitHub Desktop.

Select an option

Save lcanady/4a619357894fff2db4151307bcae6193 to your computer and use it in GitHub Desktop.
export type Next = () => void | Promise<void>;
export type Middleware<T> = (context: T, next: Next) => Promise<void> | void;
export type Pipe<T> = {
use: (...middlewares: Middleware<T>[]) => void;
execute: (context: T) => Promise<void | T>;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment