Code Monkey home page Code Monkey logo

async-middleware's Introduction

Async Middleware

NPM version NPM downloads Build status Test coverage Greenkeeper badge

Wrap an asynchronous middleware (or handler) function for Express, Connect, router, etc.

Installation

npm install async-middleware --save

Usage

Wrap a middleware function using async and/or promises to catch errors and forward them to next(err).

var express = require('express')
var wrap = require('async-middleware').wrap

var app = express()

app.use(wrap(function (req, res) {
  return Promise.reject(new Error('boom!'))
}))

License

MIT

async-middleware's People

Contributors

blakeembrey avatar greenkeeper[bot] avatar greenkeeperio-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aklagoo

async-middleware's Issues

Wrap as TS decorator

Would it be possible to use async-middleware-wrap as TS decorator ? Something like:

@Wrap
public async apiHandler (req:Request, res:Response) {

An in-range update of @types/node is breaking the build 🚨

Version 8.0.44 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.43
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ coverage/coveralls Coverage pending from Coveralls.io Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.18 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.17
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ coverage/coveralls Coverage pending from Coveralls.io Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of typescript is breaking the build 🚨

Version 2.0.8 of typescript just got published.

Branch Build failing 🚨
Dependency typescript
Current Version 2.0.7
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As typescript is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

  • βœ… coverage/coveralls First build on greenkeeper/typescript-2.0.8 at 100.0% Details

Commits

The new version differs by 5 commits .

  • cc81fa7 Update LKG
  • 1a698df Update version
  • df65cc3 Update LKG
  • 435270e reduce set of files being watched, increase polling interval (#12054)
  • 7c92057 enable sending telemetry events to tsserver client (#12035)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Type inference is not working

With the latest version of @types/express, I cannot use wrap() without having to explicitly declare the types of req, res and next.

Without wrap(), the types are inferred.

This is especially unfortunate because app.get() is now generic and you customize the parameter types of a route, but this way you need to duplicate them.

Broken by an Express types update

G'day, it looks like Express has updated their type definition of NextFunction to:

export interface NextFunction {
    (err?: any): void;
    /**
     * "Break-out" of a router by calling {next('router')};
     * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}
     */
    (deferToNext: "router"): void;
}

Which means it is incompatible with the NextFunction definition in this module's index.d.ts.

I'm working around this myself by explicitly importing NextFunction from Express to type the wrapper function.

Cheers!

An in-range update of typescript is breaking the build 🚨

Version 2.4.1 of typescript just got published.

Branch Build failing 🚨
Dependency typescript
Current Version 2.4.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As typescript is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes TypeScript 2.4

For release notes, check out the release announcement

For new features, check out the What's new in TypeScript 2.4.

For breaking changes, check out the Breaking changes in TypeScript 2.4 page.

For the complete list of fixed issues, check out the fixed issues query for Typescript 2.4.

Download:

Commits

The new version differs by 141 commits.

  • 8b2fe13 Update LKG.
  • 14d95ed Test:Block-scoped definition of Promise works
  • a8846bf Skip block scope check with no error location
  • 44f2336 Merge pull request #16633 from Microsoft/release-2.4_fixIncrementalParsing
  • 4875a27 Add tests
  • 15ef20d Set the structureReused to be safemoudles when dynamic import change
  • 6d33083 Add tests
  • 11b9f6e Wip-fix incremental parsing
  • 2721fd4 In TypeScript code, never bind JSDoc normally, just set parent pointers (#16555) (#16561)
  • 0968ed9 Revert string enum changes (#16569)
  • 096f8cc Update LKG
  • 9241175 Allow running in strict mode (#16557)
  • f49b007 Update LKG
  • f1b0f59 Update version to 2.4.1
  • ed9cde9 Update LKG

There are 141 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.