# `Clarity.Router`
[🔗](https://github.com/team-alembic/clarity/blob/v0.6.0/lib/clarity/router.ex#L1)

Router for the Clarity LiveView application.

# `clarity`
*macro* 

Defines an `clarity` route.
It expects the `path` the clarity dashboard will be mounted at
and a set of options.

## Options

  * `:live_socket_path` - Optional override for the socket path. it must match
    the `socket "/live", Phoenix.LiveView.Socket` in your endpoint. Defaults to `/live`.

  * `:on_mount` - Optional list of hooks to attach to the mount lifecycle.

  * `:session` - Optional extra session map or MFA tuple to be merged with the session.

  * `:live_session_name` - Optional atom to name the `live_session`. Defaults to `:clarity`.

## Examples

```elixir
defmodule MyAppWeb.Router do
  use Phoenix.Router

  scope "/" do
    import Clarity.Router

    # Make sure you are piping through the browser pipeline
    # If you don't have one, see `clarity_browser_pipeline/1`
    pipe_through [:browser]

    clarity "/clarity"
  end
end
```

# `clarity_browser_pipeline`
*macro* 

Can be used to create a `:browser` pipeline easily if you don't have one.

By default it is called `:browser`, but you can rename it by supplying an
argument, for example:

```elixir
defmodule MyAppWeb.Router do
  use Phoenix.Router

  import Clarity.Router
  clarity_browser_pipeline :something

  scope "/" do
    pipe_through [:something]
    clarity "/clarity"
  end
end
```

---

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