I am using a simple JSON decode and encode (following from examples at
elm-tutorial), but I'm clearly missing something.
The db.json file has the simple structure
{
"plrs": {
"ixd": "FF",
"name": "Frank",
"level": 3
}
}
.. and I decode that successfully into an Elm object with an HTTP Get: from
http://localhost:3000/db. The Elm object holding the data has the type
Roster.
When I encode it, and try to save it with an HTTP Send (to the identical URL), I get a File Not Found 404 error.
Do I need to tweak the URL for sending the data back, or would a mistake in my Encoding code (quite a possibility) cause this to happen?
I'm running this as Administrator in case there are any permission issues.
I am using the code in the tutorial to create the HTTP request, as follows:
savePlayerRequest : Roster -> Http.Request Roster
savePlayerRequest roster =
Http.request
{ body = plrsEncoder roster |> Http.jsonBody
, expect = Http.expectJson plrsDecoder
, headers = []
, method = "PATCH"
, timeout = Nothing
, url = savePlayerUrl
, withCredentials = False
}