Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
18 additions
and 2 deletions.
- +3 −2 lib/watercooler/www.ex
- +15 −0 lib/watercooler/www/publish.ex
@@ -0,0 +1,15 @@ | ||
defmodule Watercooler.WWW.Publish do | ||
use Raxx.Server | ||
|
||
@impl Raxx.Server | ||
def handle_request(request, _state) do | ||
%{"message" => message} = | ||
request.body # 1. | ||
|> URI.decode_www_form() | ||
|> URI.decode_query() | ||
|
||
{:ok, _} = Watercooler.publish(message) # 2. | ||
|
||
redirect("/") # 3. | ||
end | ||
end |