PingPlug, a plug to echo a defined message.
The package can be installed as:
Add ping_plug
to your list of dependencies in mix.exs
:
def deps do
[{:ping_plug, "~> 1.0.0"}]
end
Plug the PingPlug
anywhere in your middleware stack. e.g. In Phoenix application, endpoint.ex
with return value
defmodule Endpoint do
# snip
plug PingPlug, path: ["_checks", "liveness"], return: "alive!"
# snip
end
with module function execution
defmodule Checks do
def execute do
{:ok, "pass!"}
end
end
defmodule Endpoint do
# snip
plug PingPlug, path: ["_checks", "readiness"], execute: {Checks, :execute, []}
# snip
end
For more information, please see document.