Standalone Spark DSL for defining typed controller routes.
Generates TypeScript path helper functions and a thin Phoenix controller
from routes configured in the DSL. This is completely independent from
Ash.Resource — routes contain colocated arguments and handler functions.
Usage
defmodule MyApp.Session do
use AshTypescript.TypedController
typed_controller do
module_name MyAppWeb.SessionController
route :login do
method :post
run fn conn, params -> Plug.Conn.send_resp(conn, 200, "OK") end
argument :code, :string, allow_nil?: false
end
route :auth do
method :get
run fn conn, _params -> Plug.Conn.send_resp(conn, 200, "Auth") end
end
end
endOptions
:extensions(list of module that adoptsSpark.Dsl.Extension) - A list of DSL extensions to add to theSpark.Dsl:otp_app(atom/0) - The otp_app to use for any application configurable options:fragments(list ofmodule/0) - Fragments to include in theSpark.Dsl. See the fragments guide for more.