What is the proper way to stop the chain of events on a Node server that was set in motion after it received a request, when that request is cancelled?
E.g.
- When you press
[escape]
while a request is done by a browser, the request is aborted. - When you call
.abort()
on a jQuery$.ajax()
. - etc
For just serving some html, this wouldn't be a big deal. The Node server renders some text and nobody listens to the output. Not a big deal.
But when the Node server is actually doing a lot of processing for the response, it would be nice to be able to stop and use the resources for something else.
Ideally some kind of trick to req
itself, so I don't have to change whole batches of code to cancel each promise individually.