🦑 Async wrapper for express functions.
Async wrapper for express functions.
$ npm i @rimiti/express-async -S
From commonJS
const {wrapAsync} = require('@rimiti/express-async');
or from ES6:
import {wrapAsync} from '@rimiti/express-async';
import express from 'express';
import {wrapAsync} from '@rimiti/express-async';
const app = express();
app.get('/example-1', wrapAsync(async function example1(req, res, next) {
res.status(200).send({example: 1});
}));
app.get('/example-2', wrapAsync(async function example2(req, res) {
res.status(200).send({example: 2});
}));
Run using yarn run <script>
command.
clean - Remove temporarily folders.
build - Compile source files.
build:watch - Interactive watch mode, compile sources on change.
lint - Lint source files.
lint:fix - Lint source files and auto-fix.
This package has been inspired by express-async-handler but
it has been totally rewrited in TypeScript.
MIT © Dimitri DO BAIRRO