27 lines
662 B
Elixir
27 lines
662 B
Elixir
defmodule QueenRouter do
|
|
use Plug.Router
|
|
|
|
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
|
|
|
|
match _ do
|
|
send_resp(conn, 404, "you lost, kitty-cat?")
|
|
end
|
|
end
|