TypeScript compliant express route handler
npm install @simpleview/express-async-handlerWrap an express handler to properly handle async errors. Same as npm express-async-handler but with better typing.
```
npm install @simpleview/express-async-handler
`typescript
import express from "express";
import { asyncWrap } from "@simpleview/express-async-handler";
const app = express();
app.get("/", asyncWrap(async function(req, res, next) {
// any errors thrown will be passed on to next() automatically
});
`
In order to get rich typing you'll want to setup some helper types. There are two primary needs for custom typing.
* Customization of the Application locals (req.app.locals, res.app.locals).req.query
* Customization of the Request (, req.body, req.session`).
There is a full example in examples/custom_typing.