David Legard
2017-11-19 07:05:35 UTC
I am using a simple JSON decode and encode (following from examples at
elm-tutorial <https://www.elm-tutorial.org/en/>), 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
}
elm-tutorial <https://www.elm-tutorial.org/en/>), 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
}
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.