Packages

Elixir library to handle generic routing tasks in Plug.Router and Phoenix router style

Current section

Files

Jump to
gen_router lib behaviour.ex
Raw

lib/behaviour.ex

defprotocol GenRouter.Behaviour do
@moduledoc """
Callbacks for custom implementation for the Router.
"""
@type router :: module()
@type message :: map()
@type path :: String.t
@type scope :: map()
@type assigns :: map()
@type view :: module()
@type template :: String.t
@type params :: map()
@type opts :: Keyword.t
@doc """
Function which converts generic message into GenRouter.Conn structure
then match it according to the router specification.
"""
@callback match_message(router, message, path, scope, assigns, opts) :: %GenRouter.Conn{}
@doc """
Renders the view and deliver response to the end client.
"""
@callback deliver(%GenRouter.Conn{}, view, template, params, opts) :: %GenRouter.Conn{}
end