Search⌘ K
AI Features

Test Driving the API

Explore how to test drive an API in Elixir using GenServer processes to manage quiz sessions and state. Understand state isolation, error handling, and how to interact with APIs exposing pure Elixir data. Gain hands-on experience with session management and how to coordinate quiz workflows through the functional core and service layers.

This exercise is the culmination of everything we’ve done in the boundary layer. We’ll roll up all the work we’ve done so far. This quiz flow will depend on the data structures we defined and use the functions we established in the functional core.

The service layers will use that functional core to track state in two pieces:

  • The quiz maker, which we call the manager.

  • The quiz taker, which we call the session.

We’ll use the client APIs from those GenServers that hide those details, so we won’t see the shapes of internal call or cast messages.

All data flowing out of the API will be pure Elixir data structures, with no custom structs.

Aside from lifecycle details, this layer will show data exactly as we’ll present it to the outside ...