Literature.Router (literature v0.1.14)

Provides LiveView routing for literature.

Link to this section Summary

Functions

Defines a Literature route.

Defines a Literature API route.

Defines routes for Literature static assets.

Defines a Literature dashboard route.

Link to this section Functions

Link to this macro

literature(path, opts \\ [])

(macro)

Defines a Literature route.

It requires a path where to mount the public page at and allows options to customize routing.

examples

Examples

Mount a blog at the path "/blog":

defmodule MyAppWeb.Router do
  use Phoenix.Router
  use Literature.Router

  scope "/", MyAppWeb do
    pipe_through [:browser]

    literature "/blog"
  end
end
Link to this macro

literature_api(path, opts \\ [])

(macro)

Defines a Literature API route.

examples

Examples

defmodule MyAppWeb.Router do
  use Phoenix.Router
  use Literature.Router

  literature_api "/api"
end
Link to this macro

literature_assets(path)

(macro)

Defines routes for Literature static assets.

Static assets should not be CSRF protected. So they need to be mounted in your router in a different pipeline.

It can take the path the literature assets will be mounted at.

usage

Usage

# lib/my_app_web/router.ex
use MyAppWeb, :router
import Literature.Router
...

scope "/" do
  literature_assets("/")
end
Link to this macro

literature_dashboard(path, opts \\ [])

(macro)

Defines a Literature dashboard route.

It requires a path where to mount the dashboard at and allows options to customize routing.

examples

Examples

Mount an literature dashboard at the path "/literature":

defmodule MyAppWeb.Router do
  use Phoenix.Router
  use Literature.Router

  scope "/", MyAppWeb do
    pipe_through [:browser]

    literature_dashboard "/literature"
  end
end