express
express copied to clipboard
Create types for error handler with 4 params
https://expressjs.com/en/guide/error-handling.html
And also for promise support
Starting with Express 5, route handlers and middleware that return a Promise will call next(value) automatically when they reject or throw an error. For example:
app.get('/user/:id', async (req, res, next) => {
const user = await getUserById(req.params.id)
res.send(user)
})