Skip to content

Instantly share code, notes, and snippets.

@robmckinnon
Created April 10, 2018 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robmckinnon/9dd656a7e68384d65306849959da84ed to your computer and use it in GitHub Desktop.
Save robmckinnon/9dd656a7e68384d65306849959da84ed to your computer and use it in GitHub Desktop.
Add GenServer implementation to supervision tree in application.ex
defmodule NodeProcess.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
# List all child processes to be supervised
children = [
# Starts a worker by calling: NodeProcess.Worker.start_link(arg)
{NodeProcess.Server, :ok}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: NodeProcess.Supervisor]
Supervisor.start_link(children, opts)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment