Skip to content
🦑 Async wrapper for express functions.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__
src
.editorconfig
.gitignore
.npmignore
.prettierrc
.travis.yml
LICENSE
README.md
jest.config.js
package.json
tsconfig.json
tsconfig.release.json
tslint.json
yarn.lock

README.md

express-async

Build Status Dependencies MIT License PRs Welcome

Description

Async wrapper for express functions.

Install

$ npm i @rimiti/express-async -S

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

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

You can’t perform that action at this time.