I’m writing my first Yesod app.
The application involves the user selecting to view a graph, dynamically generated based on data stored in a DB on the server.
I know how to get the user request and create the image on the server’s file system, but how do I create a response page presenting it?
P.S. As I’m using GnuPlot to generate the image, I only know how to write it as a file to the file system, but If you happen to know how to get the data in memory it’ll probably be even better.
Thanks,
For a file on disk, you can use
sendFilein your handler.For sending it from a
ByteStringin memory, usesendResponse.Make sure you specify the correct content type for your image.