Answers for "elixir dynamic supervisor"

0

how to add supervisor to elixir

defmodule KV.Supervisor do
  use Supervisor

  def start_link(opts) do
    Supervisor.start_link(__MODULE__, :ok, opts)
  end

  @impl true
  def init(:ok) do
    children = [
      KV.Registry
    ]

    Supervisor.init(children, strategy: :one_for_one)
  end
end

## this way you have added KV.Supervisor for KV.Registry
Posted by: Guest on August-26-2020

Browse Popular Code Answers by Language