Respond to health checks without needing a route or controller action.
Optionally, add the health check plug in your endpoint before Plug.Logger in order to respond
to health checks without adding noise to your logs.
Add plug_health to your list of dependencies in mix.exs:
def deps do
[
{:plug_health, "~> 0.1.0"}
]
endCall the plug in your endpoint.ex
plug HealthCheckPlug, path: "/alive"path- The request pathcheck_func- A function that accepts one argument:Plug.Connand, by default, returns a boolean as the result.respond_func- A function that accepts two arguments:Plug.Connand the result from thecheck_func. This function must return aPlug.Conn.