@khinenw/express-async-router
v1.0.0
Published
An async router for express
Downloads
1
Readme
express-async-router
An async router for express
Features
- automatically detects sync / async.
- supports all methods (use, get, post, delete, ...)
- supports param
Usage
const createAsyncRouter = require('express-async-router');
const router = createAsyncRouter();
router.get('/', myAsyncMiddleware, syncMiddleware, async (req, res, next) => {
// whatever
if(somethingErrornous)
throw new Error("This does not become unhandled rejection");
// otherwise call next like usual
next();
});