Middleware
Different from grape, middleware of maru is a standalone plug.
There's no before
or after
callback within middleware
, middleware
is just a plug with Maru.Response
helper.
defmodule Before do
use Maru.Middleware
def call(conn, _opts) do
IO.puts "before request"
conn
end
end
defmodule API do
use Maru.Router
plug Before
mount Router
end
Updated less than a minute ago