In this chapter, we learned how to Create, Read, Update, and Delete (CRUD) resources on a server from an Elm app. The built-in modules —
Json.Encode — provide everything we need for creating CRUD requests. We discovered a third-party package called
NoRedInk/elm-decode-pipeline that provides a much better syntax for decoding JSON. It is also more powerful than
Json.Decode allowing us to easily decode an object with more than eight fields.
Another third-party package called
krisajenkins/remotedata made us realize that an HTTP request can be in one of these four states at any given time:
Failure. We used that knowledge to improve our app’s UI by properly handling those states.
As we started adding more features to our app, we realized that we needed to split our code into smaller modules. We followed a simple structure recommended by Kris Jenkins — the author of
We built separate pages for creating, updating, and retrieving resources from a server. The
UrlParser modules helped us route users to correct pages based on paths.