I am making an Nodejs and express based app where orders for certain products can be taken. In that app, as soon as an order comes it is saved to database and then a pdf is generated as order receipt. Generating a pdf take some time hence I send data to user as soon as the order is saved in database. But there is a table on the place order page where all previous orders are shown. Since pdf is generated after sending the response to user I have to continuously poll the server to check if any new orders were placed which is not optimized at all. So is there a way to send response once again to same request.here is code representation of what I want to achieve
//import Order model
app.post('/',async (req,res)=>{
let order = new Order(//data from req obj)
await order.save();
res.json({msg : 'order saved'});
//generate pdf and save it on cloud
res.json({pdfLink : pdf.link})
})