doesn't work, switching to rust
This commit is contained in:
parent
248574eabc
commit
31fb2000f0
4 changed files with 28 additions and 9 deletions
3
config/runtime.exs
Normal file
3
config/runtime.exs
Normal file
|
@ -0,0 +1,3 @@
|
|||
import Config
|
||||
|
||||
config(:queen, :secret_key_base, System.fetch_env!("QUEEN_COOKIE_SECRET"))
|
29
lib/queen.ex
29
lib/queen.ex
|
@ -1,12 +1,27 @@
|
|||
defmodule Queen do
|
||||
import Plug.Conn
|
||||
defmodule QueenRouter do
|
||||
use Plug.Router
|
||||
|
||||
def init(opts) do
|
||||
opts
|
||||
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
|
||||
|
||||
def call(conn, _opts) do
|
||||
:logger.debug("saying hello")
|
||||
send_resp(conn, 200, "hello from queen")
|
||||
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
|
||||
|
|
|
@ -8,7 +8,7 @@ defmodule Queen.Application do
|
|||
@impl true
|
||||
def start(_type, _args) do
|
||||
children = [
|
||||
{Bandit, plug: Queen}
|
||||
{Bandit, plug: QueenRouter}
|
||||
# Starts a worker by calling: Queen.Worker.start_link(arg)
|
||||
# {Queen.Worker, arg}
|
||||
]
|
||||
|
|
3
mix.exs
3
mix.exs
|
@ -15,7 +15,8 @@ defmodule Queen.MixProject do
|
|||
def application do
|
||||
[
|
||||
# extra_applications: [:logger, :ecto_sqlite3, :ecto, :bandit, :plug]
|
||||
extra_applications: [:logger]
|
||||
extra_applications: [:logger],
|
||||
mod: {Queen.Application, []}
|
||||
]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue