Current section
Files
Jump to
Current section
Files
priv/template/lib/app_name/www/actions/home_page.ex.eex
defmodule <%= @module %>.WWW.Actions.HomePage do use Raxx.SimpleServer use <%= @module %>.WWW.Layout, arguments: [:title] @impl Raxx.SimpleServer def handle_request(_request = %{method: :GET}, _state) do title = "Raxx.Kit" response(:ok) |> render(title) end def handle_request(request = %{method: :POST}, _state) do case URI.decode_query(request.body) do %{"name" => name} -> greeting = <%= @module %>.welcome_message(name) response(:ok) |> render(greeting) _ -> response(:bad_request) |> render("Bad Request") end end # Template helper functions. # Add shared helper functions to <%= @module %>.WWW.Layout.end