7.0.4 • Published 4 years ago

app-builder v7.0.4

Weekly downloads
6,723
License
MIT
Repository
github
Last release
4 years ago

app-builder

Actions Status

Create composable promise based middleware pipelines, using the "onion" middleware model.

Install:

npm install app-builder

Example

import { compose } from 'app-builder'

const app = compose([
  async function (ctx, next) {
    ctx.value += 1
    await next()
    ctx.value += 4
  },
  async function (ctx, next) {
    ctx.value += 2
    await next()
    ctx.value += 3
  }
]);

const context = { value: '' }
app(context).then(() => console.log(context.value)) // --> '1234'

All composed functions are also valid middleware functions.

const superApp = compose(
  async function (ctx, next) {
    ctx.value += 'first'
    await next()
    ctx.value += 'last'
  },
  app
)
7.0.4

4 years ago

7.0.3

4 years ago

7.0.2

4 years ago

7.0.1

4 years ago

7.0.0

4 years ago

6.2.2

5 years ago

6.2.1

5 years ago

6.2.0

5 years ago

6.1.0

5 years ago

6.0.0

6 years ago

5.2.0

7 years ago

5.1.2

7 years ago

5.1.1

8 years ago

5.1.0

8 years ago

5.0.7

9 years ago

5.0.6

9 years ago

5.0.5

9 years ago

5.0.4

9 years ago

5.0.3

9 years ago

5.0.1

9 years ago

5.0.0

10 years ago

4.1.2

10 years ago

4.1.1

10 years ago

4.1.0

10 years ago

4.0.0

10 years ago

3.0.1

10 years ago

3.0.0

10 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.2.1

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago