Tuesday, 9 May 2017

REST - send response after processing

I have a RESTful service on which other clients do POST. The request that is received should contain some useful data which are put in a queue on further processing. Just after the request from queue is processed, I get to decide what will be in the response. But the problem is that I am doing this processing in a completely different module. How can I return response to the client that sent me request, because I need to wait for some time after the processing finishes? And what if another client does POST while I didn't respond to the first one? Thanks in advance!

router.route('/')
 .post(function(request, response) {
      //here im sending request on a processing
      processing(request);
     //i want to send response when processing is finished and it takes some time
 });



via Suki

No comments:

Post a Comment