1.2.0 • Published 4 years ago

express-async-handler v1.2.0

Weekly downloads
82,822
License
MIT
Repository
github
Last release
4 years ago

Simple middleware for handling exceptions inside of async express routes and passing them to your express error handlers.

Installation:

npm install --save express-async-handler

or

yarn add express-async-handler

Usage:

const asyncHandler = require('express-async-handler')

express.get('/', asyncHandler(async (req, res, next) => {
	const bar = await foo.findAll();
	res.send(bar)
}))

Without express-async-handler

express.get('/',(req, res, next) => {
    foo.findAll()
    .then ( bar => {
       res.send(bar)
     } )
    .catch(next); // error passed on to the error handling route
})

Import in Typescript:

import asyncHandler from "express-async-handler"
demo_create_mern_appnode-scaffoldingpapiea-enginepapiea-sdkelixir-health-serverworks-api-reportexpress-typescript-templaterest-smtp-sinkoicmanager@infinitebrahmanuniverse/nolb-express-a@statstic/gb2260@everything-registry/sub-chunk-1631gb2260-xrr_backend_common@viy-ui/preview-serverstaart-managerstarter-e3starter-mern-backend-packstrapi-ethwallet-custom-field@dendronhq/api-serverkarinasjsmetabackendlatest-mycontact-backendincmsliscomatic-uilofi-envln-dashkoomia@walmartlabs/cookie-cutter-kubernetes@ulvimemmeedov/expressjsplus@tossdev/gb2260@tomfischer/middleware@tonoid/express@towercg2/server@thermopylae/demo.express@transcend-io/typescript-webhook-example@vifros/serverless-json-api@yandex/tex-renderer@zeplo/util@zeplo/cli@tensei/corealpha-command-bus-rpc-serveraccount-serviceatomicagentauth-package-t1auth-middleware-jwtantopolisecom-express-utilsantopolis-express-utilsapi-mock-upaplikasi-kpgeneric-express-controllerfull_auth_moduleganeyipganeyipackganeyipackage0ganeyipackage1gb_utilselectrs-batch-serverdsd-rest-route-core-libecommerce-express-utilsecommerce-online-storeechoedecr-bisag-backendezshareexpress-gen-cliexpress-mvcxexpress-async-router-handlerexpress-disexpress-ecma-boilerplate-mongodbethereum-scraperethereum-scrapperexpressfold-frameworkexpress-sms-authfeedsmefb-dev-base-packagefetch-api-jsonplaceholder@0x/coordinator-server@0x/quote-server@3merge/express-auth-middleware@3merge/express-starter@prairielearn/session@proshop/common@blossm/authentication-middleware@blossm/authorization-middleware@blossm/server@brightspot/styleguide@carolina.js/auth@backplane-software/backplane-api@backplane-software/backplane-aws@backplane-software/backplane-azure@backplane-software/backplane-gcp@axenuab/joymon-admin-user-portal-backendceseat-auth-toulouse2campaign-server-sdkcampaign-server-sdk1classassginmentcommon-credit-scoringcodeweavercor-base-service
1.2.0

4 years ago

1.1.4

7 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago