Is it possible to trigger a file download in a browser from the GraphQL endpoint on an apollo-server-express
application?
I have the endpoint written in a standard express app.get
function (see below) but I would like to make use of the GraphQL context for file download and so I'm wondering if it's possible to cause a download from a GraphQL endpoint.
Here's a bare-bones example of what I have on the express end in the app.get
function:
app.get('/download-batch/:batchId', async (req, res) => {
res.send(new Buffer('test'));
});
Any help would me much appreciated. Thanks!