Adding More Functionality to the QuizManager
Explore how to extend the QuizManager by adding templates, supporting fetches, and creating a cleaner API using GenServer in Elixir. Understand how to handle state updates and isolate process logic to improve interaction with the core application components.
We'll cover the following...
We'll cover the following...
Adding a template
That first call we made in the previous lesson is a little tricky, but the rest will look the same. Let’s add a template to lib/mastery/boundary/quiz_manager.ex:
This callback uses the same technique to add templates to a quiz:
-
We invoke
Quiz.add_templatefrom our core and store that result to our map usingMap.update. -
We return
:okto the user and set the new ...