diff --git a/README.md b/README.md index b6ffedb..f6224a9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## PragTechnologies - Coding Bootcamp (Elixir) +## PragTechnologies - Coding Bootcamp (Elixir & OTP) #### Each Code Progress can be viewed on my [Commit History 🔄](https://github.com/skedaddl3/elixir-pragstudio/commits/master) diff --git a/lib/kick_starter.ex b/lib/kick_starter.ex index 0b80962..32b6e2c 100644 --- a/lib/kick_starter.ex +++ b/lib/kick_starter.ex @@ -21,7 +21,8 @@ defmodule Servy.KickStarter do defp start_server do IO.puts("Starting the HTTP Server...") - server_pid = spawn_link(Servy.HttpServer, :start, [4000]) + port = Application.get_env(:servy, :port) + server_pid = spawn_link(Servy.HttpServer, :start, [port]) Process.register(server_pid, :http_server) server_pid end diff --git a/lib/servy.ex b/lib/servy.ex index 5c941a9..241d394 100644 --- a/lib/servy.ex +++ b/lib/servy.ex @@ -1,7 +1,8 @@ defmodule Servy do - def hello(name) do - "Hello, #{name}!" + use Application + + def start(_type, _args) do + IO.puts("Starting the application...") + Servy.Supervisor.start_link() end end - -IO.puts(Servy.hello("Elixir")) diff --git a/mix.exs b/mix.exs index ce19873..8661340 100644 --- a/mix.exs +++ b/mix.exs @@ -4,6 +4,7 @@ defmodule Servy.MixProject do def project do [ app: :servy, + description: "A humble HTTP server", version: "0.1.0", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, @@ -14,7 +15,9 @@ defmodule Servy.MixProject do # Run "mix help compile.app" to learn about applications. def application do [ - extra_applications: [:logger] + extra_applications: [:logger], + mod: {Servy, []}, + env: [port: 3000] ] end