Closed ZacHilbert closed 7 years ago
I don't really know if this is at all helpful, but have you looked into Aeson?
Yes. I used Aeson for generating/parsing JSON.
I've actually found away to do this where I can just skip generating JSON to pass to the client. I am able to to use FFI within event handlers to interact with the client side javascript objects.
It appears to me that this issue is no longer relevant? Please reopen it if I am mistaken!
I am interested in serving requests other than than /. For instance, I would like to request localhost:8023/custom.json and have server-side code generate the response. I considered just writing files to /static/custom.json, but having the request handled dynamically may have some advantages. In looking at the code, it seems I could mimic the approach that is used to server up Haskell.js (that is, implement a function like jsDriveCode :: Text, and then modify the routeResources function in Server.hs.) Does this seem like a sound approach?
A more robust solution would be to expose a function that registers the custom handler.
My use case for this is that I am using a jQuery library that consumes JSON and I would like to generate that JSON on the server on-demand from the client.