mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
43 lines
783 B
Elixir
43 lines
783 B
Elixir
defmodule API do
|
|
def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)
|
|
|
|
def router do
|
|
quote do
|
|
use Phoenix.Router, helpers: false
|
|
import Plug.Conn
|
|
import Phoenix.Controller
|
|
end
|
|
end
|
|
|
|
def channel do
|
|
quote do
|
|
use Phoenix.Channel
|
|
end
|
|
end
|
|
|
|
def controller do
|
|
quote do
|
|
use Phoenix.Controller,
|
|
formats: [:html, :json],
|
|
layouts: [html: API.Layouts]
|
|
|
|
import Plug.Conn
|
|
|
|
unquote(verified_routes())
|
|
end
|
|
end
|
|
|
|
def verified_routes do
|
|
quote do
|
|
use Phoenix.VerifiedRoutes,
|
|
endpoint: API.Endpoint,
|
|
router: API.Router,
|
|
statics: API.static_paths()
|
|
end
|
|
end
|
|
|
|
defmacro __using__(which) when is_atom(which) do
|
|
apply(__MODULE__, which, [])
|
|
end
|
|
end
|