Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

pawelgalazka/middleware

Repository files navigation

middleware

Simple middleware pattern engine

npm install --save @pawelgalazka/middleware
import { middleware, Middleware } from '@pawelgalazka/middleware'

interface IMiddlewareArguments {
  arg1: string
  arg2: string
}

type CustomMiddleware = Middleware<IMiddlewareArguments>


const middleware1: CustomMiddleware = next => ({arg1, arg2}) => {
  next({
    arg1: arg1 + 'e'
    arg2: arg2 + 'f'
  })

}

const middleware2: CustomMiddleware = next => ({arg1, arg2}) => {
  console.log('ARGS', arg1, arg2)
}

middleware([middleware1, middleware2])({arg1: 'a', arg2: 'b'})
ARGS ae bf

About

Simple middleware pattern engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published