ts-async-express-middleware
v1.0.2
Published
Adds express middleware that works with typescript
Downloads
1
Readme
ts-async-express-middleware
Adds express middleware that works with typescript
To install run
npm install ts-async-express-middleware
Including async middleware will handle exceptions from futures correctly so you do not need to wrap every request in a try/catch for async operations
import asyncMiddleware from 'ts-async-express-middleware';
function delay(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
app.get(
'/pass',
asyncMiddleware(async (req, res, next) => {
await delay(500);
res.send('this passed');
})
);