GenRouter.Behaviour behaviour (gen_router v0.1.9)

Callbacks for custom implementation for the Router.

Summary

Callbacks

Renders the view and deliver response to the end client.

Function which converts generic message into GenRouter.Conn structure then match it according to the router specification.

Types

assigns()

@type assigns() :: map()

message()

@type message() :: map()

opts()

@type opts() :: Keyword.t()

params()

@type params() :: map()

path()

@type path() :: String.t()

router()

@type router() :: module()

scope()

@type scope() :: map()

template()

@type template() :: String.t()

view()

@type view() :: module()

Callbacks

deliver(%GenRouter.Conn{}, view, template, params, opts)

@callback deliver(
  %GenRouter.Conn{
    __skip__: term(),
    assigns: term(),
    code: term(),
    halted: term(),
    params: term(),
    path: term(),
    response: term(),
    scope: term()
  },
  view(),
  template(),
  params(),
  opts()
) :: %GenRouter.Conn{
  __skip__: term(),
  assigns: term(),
  code: term(),
  halted: term(),
  params: term(),
  path: term(),
  response: term(),
  scope: term()
}

Renders the view and deliver response to the end client.

match_message(router, message, path, scope, assigns, opts)

@callback match_message(router(), message(), path(), scope(), assigns(), opts()) ::
  %GenRouter.Conn{
    __skip__: term(),
    assigns: term(),
    code: term(),
    halted: term(),
    params: term(),
    path: term(),
    response: term(),
    scope: term()
  }

Function which converts generic message into GenRouter.Conn structure then match it according to the router specification.