Answer the question
In order to leave comments, you need to log in
Request Handlers in ExpressJS
Problem following - there is a request handler with huge logic. Processing lasts from 5 to 20 minutes. If the client closes the connection, express stops executing the handler. How can I tell him not to do it? Those. after the connection is closed by the client, do not stop the handler.
Answer the question
In order to leave comments, you need to log in
Are you kidding me? Node.js is asynchronous. Fully. Revisit the logic.
You can do it like this, for example:
app.get("/", function(req, res){
setTimeout(function(result){
// some logic
console.log('finished');
},1000*5);
res.end('Processing..');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question