README.md

# ElixirCms

A developer friendly content management system written for Elixir

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `elixir_cms` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:elixir_cms, "~> 0.1.0"}
  ]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/elixir_cms](https://hexdocs.pm/elixir_cms).

## Usage

In a Phoenix application, you will typically have a router generated for you.
Adding an `/admin` scope to forward requests to the ElixirCMS router will
give you a basic admin interface.

```elixir
defmodule JackWebsiteWeb.Router do
  # the following is generated by Phoenix
  use JackWebsiteWeb, :router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", JackWebsiteWeb do
    pipe_through :browser

    get "/", PageController, :index
  end

  # Add the following to your router:
  # (you can replace BasicAuth with your authentication method of choice)
  pipeline :auth do
    plug BasicAuth, use_config: {:jack_website, :basic_auth}
  end

  scope "/admin" do
    pipe_through [:auth, :browser]

    forward "/", ElixirCMS.Router, namespace: "admin"
  end
end
```