Plato.Router (plato v0.0.24)

Copy Markdown View Source

Router for mounting the Plato admin interface.

Usage

In your app's router:

defmodule MyAppWeb.Router do
  use Phoenix.Router
  import Plato.Router

  scope "/" do
    pipe_through :browser
    plato_admin "/admin/cms", otp_app: :my_app
  end
end

This will mount the admin UI at /admin/cms (or any custom path you choose).

Configuration

The admin will automatically use your app's configured repo:

config :my_app, :plato,
  repo: MyApp.Repo

Custom Paths

The path is completely configurable - mount at any location:

plato_admin "/cms", otp_app: :my_app
plato_admin "/admin/content", otp_app: :my_app
plato_admin "/backstage", otp_app: :my_app

Summary

Functions

Mounts the Plato admin interface at the given path.

Functions

plato_admin(path, opts \\ [])

(macro)

Mounts the Plato admin interface at the given path.

Options

  • :otp_app - The OTP app to read config from (required)

Examples

plato_admin "/admin/cms", otp_app: :my_app
plato_admin "/cms", otp_app: :my_app