27 lines
884 B
Elixir
27 lines
884 B
Elixir
defmodule Diamondtail.Application do
|
|
# See https://hexdocs.pm/elixir/Application.html
|
|
# for more information on OTP Applications
|
|
@moduledoc false
|
|
alias Diamondtail.Genometracker
|
|
alias Diamondtail.Population
|
|
|
|
use Application
|
|
|
|
@impl true
|
|
def start(_type, _args) do
|
|
children = [
|
|
# Starts a worker by calling: Diamondtail.Worker.start_link(arg)
|
|
# {Diamondtail.Worker, arg}
|
|
{Plug.Cowboy, scheme: :http, plug: Diamondtail.Router, options: [port: 4001]},
|
|
{Task.Supervisor, name: Diamondtail.TaskSupervisor},
|
|
{Population, 1..10 |> Enum.map(fn _ -> Population.Genome.random end) |> Enum.to_list},
|
|
Genometracker
|
|
]
|
|
|
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
|
# for other strategies and supported options
|
|
opts = [strategy: :one_for_one, name: Diamondtail.Supervisor]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
end
|