I use this plug:
defmodule HelloWeb.Plug.HealthCheck do
import Plug.Conn
def init(opts), do: opts
def call(%Plug.Conn{request_path: "/healthy"} = conn, _opts) do
conn
|> send_resp(200, "")
|> halt()
end
def call(conn, _opts), do: conn
end
And then endpoint.ex uses it like this plug(HelloWeb.Plug.HealthCheck) as the first thing that gets defined. This way it does the least amount of work possible. No controller or route needed and your normal pipeline gets ignored.
Pretty sure I grabbed that snippet and slightly modified it from one of @jola’s blog posts.


















