7.0.4 • Published 3 years ago

app-builder v7.0.4

Weekly downloads
6,723
License
MIT
Repository
github
Last release
3 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

3 years ago

7.0.3

3 years ago

7.0.2

3 years ago

7.0.1

3 years ago

7.0.0

3 years ago

6.2.2

4 years ago

6.2.1

4 years ago

6.2.0

4 years ago

6.1.0

4 years ago

6.0.0

5 years ago

5.2.0

6 years ago

5.1.2

6 years ago

5.1.1

6 years ago

5.1.0

7 years ago

5.0.7

8 years ago

5.0.6

8 years ago

5.0.5

8 years ago

5.0.4

8 years ago

5.0.3

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.1.2

9 years ago

4.1.1

9 years ago

4.1.0

9 years ago

4.0.0

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.2.1

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago