Multiplex
Phoenix router macro to dispatch multiple HTTP methods to a Plug
The package adds a mux macro to your router to match one or more
HTTP verbs with a Controller (or any Plug):
defmodule MyApp.Router do
use HelloPhoenix.Web, :router
mux [:get, :post], "/pages", PageController, :index
endInstallation
Add Multiplex to your Phoenix project in two steps:
-
Add
:multiplexto your list of dependencies inmix.exs:
```elixir
def deps do
[{:multiplex, "~> 0.1.0"}]
end
```-
Edit
web/web.exand add the module:
```elixir
def router do
quote do
use Phoenix.Router
use Multiplex
end
end
```