Skip to content

xiondlph/async-wrapper-express-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

async-wrapper-express-ts

A simple function for Typescript sources to wrap async Express route

Wraps the express route in a function that passes the next method from the route to the promise's catch statement which allows the middleware to catch the exception.

This code was borrowed from the StrongLoop blog post on handling async/await routes in express. This npm module allows you to use this solution in the typescript sources.

Install

# With npm
npm install --save async-wrapper-express-ts

# With yarn
yarn add async-wrapper-express-ts

Usage

import asyncWrapper from 'asyncWrapper'
...
app.get('/foo', asyncWrapper(someAsyncRouteFunction))

About

A simple function for Typescript sources to wrap async Express route

Resources

License

Stars

Watchers

Forks

Packages

No packages published