New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

app-builder

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-builder

simple promise based middleware

  • 4.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
increased by25.35%
Maintainers
1
Weekly downloads
 
Created
Source

app-builder

Create a promise based middleware pipeline.

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'

AppBuilder#use(Function) : AppBuilder

Adds a pipeline function to the builder. The function can accept two arguments, context and a next method The next method must be invoked to continue the pipeline. If the middleware function returns a promise the pipeline will end only after all returned promises have been resolved.

AppBuilder#build : AppFunc

Get a valid middleware function that executes all built middleware

Keywords

FAQs

Package last updated on 08 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc