I simply want to add a minimal middleware to handle errors within my express typescript project.
I use errors method from celebration to let it handle celebration/joi errors, and want to add another one to handler other errors.
Here is my code:
app.use(errors()); // celebration error handling
app.use((err: any, req: Request, res: Response) => res.status(300).json(err.message));
I order to test it I try to send a GET to an endpoint who doesn't exist, and I keep getting this error: TypeError: res.status is not a function
What should I do to be able to use Request like I want ?