Tayori.Router.API (Tayori v0.1.0)

Copy Markdown View Source

The news as JSON, mounted with tayori_api/2 (imported with Tayori.Router). See Tayori.API for the routes, and the Any frontend 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 guide).

Summary

Functions

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

Functions

tayori_api(path, opts \\ [])

(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 (atom/0) - Required. The app's Tayori.Resolver, which reads the reader from the conn.

  • :page (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.