queen/lib/queen.ex

28 lines
662 B
Elixir
Raw Normal View History

2024-02-18 20:47:20 +00:00
defmodule QueenRouter do
use Plug.Router
2024-02-13 01:39:18 +00:00
2024-02-18 20:47:20 +00:00
plug(Plug.Logger)
plug(:match)
plug(:dispatch)
plug(Plug.Session, store: :cookie, key: "_queen_session", signing_salt: "J6PHP10BHF23")
plug(:fetch_session)
plug(Plug.CSRFProtection)
get "/signup" do
fetch_session(conn) |> put_session(:verify, "meow") |> send_resp(200, "signup")
end
get "/success/:payment" do
conn = fetch_session(conn)
verify = get_session(conn, :verify)
:logger.info("got verify: #{verify}")
:logger.info("got payment receipt code #{payment}")
send_resp(conn, 200, "huzzah")
end
2024-02-13 01:39:18 +00:00
2024-02-18 20:47:20 +00:00
match _ do
send_resp(conn, 404, "you lost, kitty-cat?")
2024-02-13 01:39:18 +00:00
end
end