I would like to use express to render a file AND download a file at the same time
My current code is as follows:
res.attachment('filename.csv');
res.render('pages/result', { data });
However, if I do this, it only downloads the data and does not render the view
What I want is to render a success page, and then send the file so that it downloads
I need this to be done with 1 endpoint, because, I need to generate the file and only if it is successful, I would render the success page
Am I able to do this with 1 endpoint?
Thank you