Integrating a Function to Persist Records
Let’s learn to write a function that we can optionally use to save records to a database or file.
For this feature, let’s go from the outside in, addressing the outer API layer first. That way, we can think about the shape of our external APIs.
Pulling a persistence function from the environment
In /lib/mastery.ex
, we need to pull a persistence function from the environment to dictate the persistence mechanism, like this:
Get hands-on with 1200+ tech skills courses.