esrom/ui/lib/ui_web/controllers/page_controller.ex

26 lines
506 B
Elixir
Raw Normal View History

2019-07-13 18:16:46 +00:00
defmodule UiWeb.PageController do
use UiWeb, :controller
def index(conn, _params) do
2019-08-17 13:30:58 +00:00
conn |> send_resp(204, "")
end
def instructions(conn, _params) do
conn |> render(:instructions)
end
def morse(conn, _params) do
conn |> render(:morse)
end
def start(conn, _params) do
response =
case Morse.Server.start_morse() do
:ok -> "Started."
{:error, :already_started} -> "The process is still in progress..."
end
conn |> text(response)
2019-07-13 18:16:46 +00:00
end
end