NextJS
Respond with PDF from API route
How to respond with a PDF from an API route
api/pdf/index.ts
This will take the incoming PDF from a service and forward the response to the User. Setting the Content-Disposition
in this way will result in the PDF being downloaded. Removing attachment
will serve the PDF in browser.