Skip to content

Commit

Permalink
application
Browse files Browse the repository at this point in the history
  • Loading branch information
hexisdylan committed Jul 27, 2022
1 parent ad82174 commit 2d5599d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
3 changes: 2 additions & 1 deletion lib/kick_starter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/servy.ex
Original file line number Diff line number Diff line change
@@ -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"))
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down

0 comments on commit 2d5599d

Please sign in to comment.