1.0.7 • Published 1 year ago

@cdellacqua/express-async-wrapper v1.0.7

Weekly downloads
10
License
MIT
Repository
github
Last release
1 year ago

express-async-wrapper

Enable support for async syntactic sugar in express middlewares and request handlers

NPM Package

npm install @cdellacqua/express-async-wrapper

How To

Whenever an awaited promise rejects, the asyncWrapper will handle the exception passing it to the next available middleware

import { asyncWrapper } from '@cdellacqua/express-async-wrapper';

router.get('/example', asyncWrapper(async (req, res) => {
	await somethingThatReturnsAPromise();
	res.send('done');
}));
import { asyncWrapper } from '@cdellacqua/express-async-wrapper';

app.use(asyncWrapper(async (req, res, next) => {
	await somethingThatReturnsAPromise();
	next();
}));
1.0.7

1 year ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago