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, Composable, promise based middleware pipelines

  • 5.0.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

app-builder

Create composable promise based middleware pipelines.

npm install app-builder

circle-ci

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'

This module has the following TypeScript definition, containing 2 named exports and default factory export. As well as a Middleware interface definition

declare module 'app-builder' {

  export default function createAppBuilder<T>() : AppBuilder<T> 

  export class AppBuilder<T> {
    use(middleware: Middleware<T>): AppBuilder<T>
    build(): Middleware<T>
  }

  export function compose<T> (middleware: Array<Middleware<T>|Array<Middleware<T>>) : Middleware<T>

  export interface Middleware<T> {
    (context?: T, next?: Middleware<T>): Promise<any>
  }
}

Keywords

FAQs

Package last updated on 10 Jul 2016

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