I am trying to get a basic JSON message from client to server, 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 "http://localhost:3000" "{foo : true}"
The server is exactly as shown in this part of Yesod .
However, when I run the query, I get the output
"\"Failure 0 []\""
Does anyone know what I need to do so that the Elm client communicates correctly with the Yesod server? I tried the Python client and the queries work fine. Similarly, there are several examples on the Yesod website with successful Http requests, so I am sure that both libraries are working properly, but I am using them incorrectly.
UPDATE: client side problem. I managed to get it to work with chrome with disabled security settings and no changes to Yesod. I will look for a workaround, but at least it is enough for my development to continue.
json ajax haskell elm yesod
jmite
source share