Literature.Router (literature v0.2.17)

Provides LiveView routing for literature.

Summary

Functions

Link to this macro

custom_show_author_route(custom_routes, route_opts)

(macro)
Link to this macro

custom_show_tag_route(custom_routes, route_opts)

(macro)
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

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

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

# 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

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