How to send JSON between Elm Client and Haskell (Yesod) server
I'm trying to get basic JSON communication from client to server going,
with the following Elm code:
import open Http
result res = case res of
Success a -> a
Waiting -> "Waiting"
Failure n a-> "Failure " ++ (show n) ++ " " ++ (show a)
main = lift asText <| lift (show . result) <| send <| constant <| post
The server is exactly as shown in this part of the Yesod book.
However, when I run the request, I get the output
"\"Failure 0 []\""
Does anybody know what I have to do to get an Elm client properly
communicating with a Yesod server? I've tried a Python client, and the
requests work just fine. Likewise, there are several examples on the Yesod
site with successful Http requests, so I'm confident both libraries are
working properly, but that I'm using them wrong.
No comments:
Post a Comment