heartcheck v0.3.0 HeartCheck.Plug View Source

Plug to mount heartcheck in your plug-compatible app

Add to your router:


def MyApp.Router
  use Plug.Router
  # (...)
  forward "/monitoring", to: HeartCheck.Plug, heartcheck: MyHeart
end

Or phoenix pipeline (note the different syntax):


def MyApp.Router
  use MyApp.Web, :router

  # (...)

  scope "/", MyApp do
    pipe_through :browser

    # (...)

    forward "/monitoring", HeartCheck.Plug, heartcheck: MyHeart
  end
end

In any of the cases above, if you wish to cache the HeartCheck results for a time, mount the HeartCheck.CachingPlug instead of HeartCheck.Plug:


def MyApp.Router
  use Plug.Router

  require HeartCheck

  # (...)

  forward "/monitoring", to: HeartCheck.CachingPlug, heartcheck: MyHeart
end

or on phoenix:


def MyApp.Router
  use MyApp.Web, :router

  require HeartCheck

  # (...)

  scope "/", MyApp do
    pipe_through :browser

    # (...)

    forward "/monitoring", HeartCheck.CachingPlug, heartcheck: MyHeart
  end
end

Link to this section Summary

Functions

Callback implementation for Plug.call/2

Callback implementation for Plug.init/1

Link to this section Functions

Link to this function call(conn, arg2) View Source
call(Plug.Conn.t(), term()) :: Plug.Conn.t()

Callback implementation for Plug.call/2.

Link to this function init(options) View Source
init(term()) :: term()

Callback implementation for Plug.init/1.