我正在使用Plug,我想了解.
我的代码看起来像:
defmodule Numerino.Plug do
use Plug.Router
use Plug.Debugger
plug :put_resp_content_type, "application/json"
plug :match
plug :dispatch
def init options do
IO.inspect options
options
end
get "/" do
conn
|> IO.inspect
|> send_resp(201, "world")
end
match _ do
send_resp(conn, 404, "Not found.")
end
end
Run Code Online (Sandbox Code Playgroud)
在get中我需要使用option传递的参数.
如何访问保持相同Plug.Router语法的选项?