I am working on a NODE JS project with Typescript started by other people and I need to trigger an action if the response from some endpoints is successful, so I need to intercept this response before it is sent to the entity that is making the request.
The request is made, first it goes through anothers middlewares, then it goes to the controller, when it finishes, I need to catch it.
The way the responses are returned from controllers is this
return response.status(200).json(data);
How can I solve this issue?