# `AshTypescript.TypedController`
[🔗](https://github.com/ash-project/ash_typescript/blob/v0.17.3/lib/ash_typescript/typed_controller.ex#L5)

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
    end

### Options

* `:extensions` (list of module that adopts `Spark.Dsl.Extension`) - A list of DSL extensions to add to the `Spark.Dsl`

* `:otp_app` (`t:atom/0`) - The otp_app to use for any application configurable options

* `:fragments` (list of `t:module/0`) - Fragments to include in the `Spark.Dsl`. See the fragments guide for more.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
