Building the API Layer

Let’s learn how to build the API layer and discuss the importance of incorporating this layer into our project.

Our API layer will name the concepts of the GenServer and smooth out some of the rough edges. We’ll build a lightweight API that uses the GenServer module to do the following:

  • starts

  • calls

  • casts

Declaring the module and aliases

The first step is to do the typical imports we need. In /lib/mastery.ex, we’ll delete the default implementation and set up the aliases we need:

Get hands-on with 1300+ tech skills courses.