diff --git a/lib/polar_web/endpoint.ex b/lib/polar_web/endpoint.ex index e21ba72..e7acb9e 100644 --- a/lib/polar_web/endpoint.ex +++ b/lib/polar_web/endpoint.ex @@ -15,6 +15,8 @@ defmodule PolarWeb.Endpoint do websocket: [connect_info: [session: @session_options]], longpoll: [connect_info: [session: @session_options]] + plug PolarWeb.Plugs.HealthCheck + # Serve at "/" the static files from "priv/static" directory. # # You should set gzip to true if you are running phx.digest diff --git a/lib/polar_web/plugs/health_check.ex b/lib/polar_web/plugs/health_check.ex new file mode 100644 index 0000000..edc0ab1 --- /dev/null +++ b/lib/polar_web/plugs/health_check.ex @@ -0,0 +1,18 @@ +defmodule PolarWeb.Plugs.HealthCheck do + import Plug.Conn + + def init(opts), do: opts + + def call(%Plug.Conn{request_path: "/health"} = conn, _opts) do + conn + |> send_resp( + 200, + Jason.encode!(%{ + status: "Polar serving images." + }) + ) + |> halt() + end + + def call(conn, _opts), do: conn +end diff --git a/mix.exs b/mix.exs index 876aa6a..15d080f 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Polar.MixProject do def project do [ app: :polar, - version: "0.1.1", + version: "0.1.2", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,