Let’s Code: Contact Form in Phoenix - The Public Interface
In this Let’s Code series, I will be walking through how I added a simple contact form to a Phoenix 1.4 web application. I will try to make this as general purpose as possible so that it’s easier to follow and apply to your own Phoenix applications. I encourage you to follow along, either in an existing Phoenix application or a new one.
In Part One of this series, I started with a Message module to serve as the data object for the contact form.
Let’s Code: Contact Form in Phoenix – The Schema
In this Let’s Code series, I will be walking through how I added a simple contact form to a Phoenix 1.4 web application. I will try to make this as general purpose as possible so that it’s easier to follow and apply to your Phoenix applications. I encourage you to follow along, either in an existing Phoenix application or a new one.
The contact form will take the minimal number of fields from the user (email, subject, and body) and send that information to a support email address.
Writing an API Wrapper in Elixir With HTTPoison
As developers, we often have to interface with third-party APIs. This is no different when writing Elixir apps. Rather than pulling in some third-party library that’s specific to the API, I prefer to use HTTPoison to give me the minimal amount of functionality to write my own wrapper. I prefer to own the API implementation for a few reasons:
Only the paths that are used are brought in, alleviating excess code from API implementation that isn’t used.