Files
firezone/elixir/apps/api/lib/api.ex
Jamil 127b97e588 fix(portal|website): Fix static paths for website and elixir (#3802)
Phoenix VerifiedRoutes expects directories for `statics` where we were
passing filenames too.

These are removed since they're not required -- all of the top level
files we need to serve at the root don't need VerifiedRoutes.

For the website, the files were named incorrectly.


The above issues were causing 404s on both the website and portal.
2024-02-28 20:03:42 +00:00

42 lines
715 B
Elixir

defmodule API do
def static_paths, do: ~w(assets fonts images)
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: [:json]
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