Skip to content

Commit

Permalink
Redirect wobserver to correct endpoint. (See: #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanLuites committed Feb 19, 2017
1 parent 2b63696 commit d573e9c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/wobserver/web/router/static.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ defmodule Wobserver.Web.Router.Static do
alias Wobserver.Assets

get "/" do
conn
|> put_resp_content_type("text/html")
|> send_asset("assets/index.html", &Assets.html/0);
case String.ends_with?(conn.request_path, "/") do
true ->
conn
|> put_resp_content_type("text/html")
|> send_asset("assets/index.html", &Assets.html/0);
false ->
conn
|> put_resp_header("location", conn.request_path <> "/")
|> resp(301, "Redirecting to Wobserver.")
end
end

get "/main.css" do
Expand Down

0 comments on commit d573e9c

Please sign in to comment.