# `Tayori.Router.API`
[🔗](https://github.com/hattoriai/tayori/blob/v0.1.0/lib/tayori/router/api.ex#L1)

The news as JSON, mounted with `tayori_api/2` (imported with
`Tayori.Router`). See `Tayori.API` for the routes, and the
[Any frontend](any_frontend.md) guide.

Mount it behind a pipeline that accepts JSON and has the app's session,
so that the resolver finds the app's user in the conn's assigns. For
the `:embed` feature, mount it again, behind a pipeline with no session
(see `Tayori.Embed`). For the changes that CI and GitHub send
(`Tayori.Ingest`, `Tayori.GitHub`), mount it again behind a pipeline
with no session and no CSRF protection (see the
[Automation](automation.md) guide).

# `tayori_api`
*macro* 

Mounts Tayori.Router.API at `path` in a host router.

    import Tayori.Router.API

    scope "/" do
      pipe_through :browser
      tayori_api "/tayori"
    end

## Options

* `:resolver` (`t:atom/0`) - Required. The app's `Tayori.Resolver`, which reads the reader from the conn.

* `:page` (`t:String.t/0`) - The path or address of the public page, for the `url` of each entry. By default, the `tayori_page` of the same router.

Every mount also takes the options listed in `PhoenixMountable`, such as
`:as`, `:on_mount` and `:csp_nonce_assign_key`.

---

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