Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webtask/async-function-middleware

Package Overview
Dependencies
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webtask/async-function-middleware

Webtask middleware that implements an async function programming model

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
8
Created
Source

Async function middleware

The async function middleware provides a custom programming model which allows a webtask to directly return results in an idiomatic way.

Usage

To use the async function middleware, you must create a webtask that exports an async function that returns a result:

module.exports = async function (context) {
  return { hello: context.query.name || 'Anonymous' };
}
  1. Set the wt-node-dependencies metadata property to a stringified JSON of an object having @webtask/middleware-compiler and @webtask/async-function-middleware properties whose values are the latest version of the @webtask/middleware-compiler module and this module, respectively. For example:

    {
      "@webtask/middleware-compiler": "1.5.0",
      "@webtask/async-function-middleware": "1.0.0"
    }
    
  2. Set the wt-compiler metadata property on your webtask to @webtask/middleware-compiler.

  3. Set (or add to) the wt-middleware metadata property of your webtask to contain a comma-separated list containing @webtask/async-function-middleware.

  4. Issue requests to your webtask

FAQs

Package last updated on 02 Oct 2018

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