Phoenix error updating

When we left off last time, we had the beginnings of an API.

We now have our database configured, and have the routes and controller actions in place to do GET requests.

In my next post, I will integrate this simple API with and Elm front end and demonstrate how we can extend that validation logic to perform uniqueness checking on top of the existing validations.

This release ships with exciting new features, most notably HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation.

Now that we have a working example, let’s clean up the code a bit.

The nested conditional in the update function is quite ugly, so I will factor out the “happy path” into a private function. I’m still not happy that I don’t have a consistent way of adding the status to the conn map, but I’m not going to improve that at this point.

Here we simply use the cast function to define the four required fields.My assumption here is that a database call that returns nil indicates a not found error.So I use pattern matching to return either the :ok atom (200) or the :not_found atom (404).You can use the get endpoint to conform the proper writing of data.Our final major task will be to allow the update of existing records using a put endpoint. The put request received an additional parameter which contains the id of the record being updated.

Search for phoenix error updating:

phoenix error updating-7phoenix error updating-47phoenix error updating-89phoenix error updating-19

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “phoenix error updating”

  1. With their penchant for precision and engineering, it is not surprising that Germans have a strong tradition of printmaking by woodcut and engraving.