Coherence v0.1.3 Coherence.Router
Handles routing for Coherence.
Usage
Add the following to your web/router.ex
file
defmodule MyProject.Router do
use MyProject.Web, :router
use Coherence.Router # Add this
pipeline :browser do
plug :accepts, ["html"]
# ...
plug Coherence.Authentication.Session, login: true
end
pipeline :public do
plug :accepts, ["html"]
# ...
plug Coherence.Authentication.Session
end
scope "/" do
pipe_through :public
coherence_routes :public
end
scope "/" do
pipe_through :browser
coherence_routes :private
end
# ...
end
Alternatively, you may want to use the login plug in individual controllers. In
this case, you can have one pipeline, one scope and call coherence_routes
without
any parameters. In this case, it will add both the public and private routes.
Summary
Macros
Coherence Router macro
Macros
Coherence Router macro.
Use this macro to define the various Coherence Routes.
Examples:
# Routes that don't require authentication
scope "/" do
pipe_through :public
coherence_routes :public
end
# Routes that require authentication
scope "/" do
pipe_through :browser
coherence_routes :private
end