...

/

Adding a Start Link

Adding a Start Link

Let's add a start link to our dynamic supervisor along with a function to take the quiz.

Rather than starting our start_link directly, our code will use the dynamic supervisor to start the code for us.

Defining the start_link

We’ll add this code below the child_spec code in /lib/mastery/boundary/quiz_session.ex:

Press + to interact
def start_link({quiz, email}) do
GenServer.start_link(
__MODULE__,
{quiz, email},
name: via({quiz.title, email}))
end

The start_link itself looks exactly like we’d expect. It specifies the ...