Sending multiple responses with the same response object in Express.js

后端 未结 4 627
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 15:13

I have a long running process which needs to send data back at multiple stages. Is there some way to send back multiple responses with express.js

res.send(20         


        
4条回答
  •  失恋的感觉
    2020-12-16 16:06

    res.write(JSON.stringify({
        min, 
        max, 
        formattedData
    }));
    

    or

    res.send({
        min,
        max,
        formattedData
    });
    

    refer Node Res.write send multiple objects:

提交回复
热议问题