@rimiti/express-async
v1.2.0
Published
Async wrapper for express functions.
Downloads
42
Readme
express-async
Description
Async wrapper for express functions.
How to use it?
Importation
From commonJS
const {wrapAsync} = require('@rimiti/express-async');
or from ES6:
import {wrapAsync} from '@rimiti/express-async';
Example
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});
}));
Install
$ npm i @rimiti/express-async -S
Scripts
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.
Credits
This package has been inspired by express-async-handler but it has been totally rewrited in TypeScript.
License
MIT © Dimitri DO BAIRRO