Skip to content

Instantly share code, notes, and snippets.

@renanvalentin
Created October 22, 2016 16:34
Show Gist options
  • Save renanvalentin/ed4dfd10a4253c3147c0ac15a1151631 to your computer and use it in GitHub Desktop.
Save renanvalentin/ed4dfd10a4253c3147c0ac15a1151631 to your computer and use it in GitHub Desktop.
defmodule LearningElixir do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
# Define workers and child supervisors to be supervised
# worker(LearningElixir.Worker, [arg1, arg2, arg3]),
worker(LearningElixir.Router, [])
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: LearningElixir.Supervisor]
Supervisor.start_link(children, opts)
end
def run do
{:ok, _} = Plug.Adapters.Cowboy.http LearningElixir.Router, []
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment