Behaviour for typed controller route handlers.
Implement this behaviour for handler modules passed to run: in the DSL.
The handler receives the conn and a map of normalized params, and must
return a %Plug.Conn{}.
Example
defmodule MyApp.LoginHandler do
@behaviour AshTypescript.TypedController.Route
@impl true
def run(conn, params) do
# Handle login...
Plug.Conn.send_resp(conn, 200, "OK")
end
endThen in the DSL:
route :login, method: :post, run: MyApp.LoginHandler do
argument :code, :string, allow_nil?: false
end
Summary
Callbacks
@callback run(Plug.Conn.t(), map()) :: Plug.Conn.t()