Narcoleptic's Patch Mangler

    async-wrapper-express-ts
    TypeScript icon, indicating that this package has built-in type declarations

    3.1.6 • Public • Published

    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))

    Install

    npm i async-wrapper-express-ts

    DownloadsWeekly Downloads

    123

    Version

    3.1.6

    License

    MIT

    Unpacked Size

    4.78 kB

    Total Files

    8

    Last publish

    Collaborators

    • ismax