Outerfaces.Plugs.ServeIndex.ServeIndexBehavior behaviour (Outerfaces v0.2.3)

View Source

A behavior module that defines the required callbacks for the ServeIndex plug. This module specifies the contract for ServeIndex implementations.

Summary

Types

call_params()

@type call_params() :: %{index_path: String.t(), static_asset_patterns: [Regex.t()]}

conn()

@type conn() :: Plug.Conn.t()

Callbacks

call(conn, call_params)

@callback call(conn :: conn(), call_params :: call_params()) :: conn()

default_static_asset_patterns()

@callback default_static_asset_patterns() :: [Regex.t()]

init(params)

@callback init(params :: map()) :: call_params()

serve_index_html(conn, index_path)

@callback serve_index_html(conn :: conn(), index_path :: String.t()) :: conn()

serve_static_asset(conn, static_root, index_path)

@callback serve_static_asset(
  conn :: conn(),
  static_root :: String.t(),
  index_path :: String.t()
) :: conn()

static_asset_request?(conn, asset_patterns)

@callback static_asset_request?(conn :: conn(), asset_patterns :: [Regex.t()]) ::
  boolean()