# app-builder

> Promise based composable functions for middleware

Latest version **7.0.4** (published 2021-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install app-builder
pnpm add app-builder
yarn add app-builder
bun add app-builder
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.0.4 |
| Published | 2021-06-27 |
| First published | 2015-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Caleb Boyd |
| Maintainers | calebboyd |
| Keywords | middleware, functional, composable, composition, pipeline, onion, async, compose |

## Links

- npm: https://www.npmjs.com/package/app-builder
- Repository: https://github.com/calebboyd/app-builder
- Homepage: https://github.com/ingress/app-builder
- Issues: https://github.com/ingress/app-builder/issues
- npm.io page: https://npm.io/package/app-builder

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 7.0.4 (latest) — 2021-06-27
- 7.0.3 — 2021-06-27
- 7.0.2 — 2021-06-06
- 7.0.1 — 2021-06-06
- 7.0.0 — 2021-04-10
- 6.2.2 — 2020-04-23
- 6.2.1 — 2020-03-15
- 6.2.0 — 2020-01-20
- 6.1.0 — 2020-01-11
- 6.0.0 — 2019-10-11
- 5.2.0 — 2018-01-13
- 5.1.2 — 2018-01-12
- 5.1.1 — 2017-11-27
- 5.1.0 — 2017-03-15
- 5.0.7 — 2016-08-29
- … 12 more at https://npm.io/package/app-builder/versions

## README

# app-builder

[![Actions Status](https://github.com/calebboyd/app-builder/workflows/app-builder-ci/badge.svg)](https://github.com/calebboyd/app-builder/actions)

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

## Install:

`npm install app-builder`

## Example

```javascript
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.

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

---
_Source: https://npm.io/package/app-builder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
