Skip to content

Commit

Permalink
module attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
hexisdylan committed Jul 23, 2022
1 parent 0f7f211 commit cb2934a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## PragTechnologies - Coding Bootcamp

Each Code Progress can be viewed on my [Commit History](https://github.com/skedaddl3/elixir-pragstudio/commits/master)
### Each Code Progress can be viewed on my [Commit History](https://github.com/skedaddl3/elixir-pragstudio/commits/master)

1. pragstudio-elixir-01-intro - [Introduction](https://github.com/skedaddl3/elixir-pragstudio/commit/2d7cedd6e95697d686a85a9da1c3b8ddf929c073#diff-ba7efc6b78ec91b2d2aed8b82c1a8eb5ec11ed843c6ab6ff2db4f04e0ccb05b0)

Expand Down
9 changes: 5 additions & 4 deletions lib/handler.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
defmodule Servy.Handler do
@moduledoc "Handles HTTP requests."
@pages_path Path.expand("../pages", __DIR__)
@doc "Transforms the request into a response."
def handle(request) do
request
|> parse
Expand All @@ -9,6 +12,7 @@ defmodule Servy.Handler do
|> format_response
end

@doc "Logs 404 requests"
def track(%{status: 404, path: path} = conv) do
IO.puts("Warning: #{path} is on the loose!")
conv
Expand Down Expand Up @@ -51,10 +55,7 @@ defmodule Servy.Handler do
end

def route(%{method: "GET", path: "/about"} = conv) do
Path.expand(
"../pages",
__DIR__
)
Path.expand("../pages", __DIR__)
|> Path.join("about.html")
|> File.read!()
|> handle_file(conv)
Expand Down

0 comments on commit cb2934a

Please sign in to comment.