View Source SignificaUtils.HealthRouter (significa_utils v0.0.7)

Simple all-in-one health router (with handlers).

usage

Usage:

In you router, use Phoenix.Router.html.forward/4 to use this router (or match).

forward "/healthz", SignificaUtils.HealthRouter,
  repo: MyProject.Repo,
  otp_app: :my_project

It will create 3 routes under the specified prefix (/healthz in the example above):

  • /: Returns OK (we include content as it is sometimes strange to have zero length responses).
  • /db: Uses ecto and the provided repo to return the version of the latest Ecto migration.
  • /version: Returns the value of the :app_version env, specified in your otp_app. Make sure you have used Application.put_env/3 or defined the app_version in your configs:
      config :my_project,
        app_version: "1.2.3"