feat(api): new api logic for OPTIONS /version

this api will be the health check api, with the success health check will be return the application version and the runtime version
This commit is contained in:
2025-12-07 16:33:12 +07:00
parent f08cf7b54c
commit c2a192d499

View File

@@ -2,18 +2,19 @@ defmodule BlogserviceWeb.VersionController do
use BlogserviceWeb, :controller use BlogserviceWeb, :controller
def version(conn, _params) do def version(conn, _params) do
runtime_elixir = Application.spec(:elixir, :vsn) |> List.to_string() runtime_elixir = Application.spec(:elixir, :vsn)
runtime_application = Application.spec(:blogservice, :vsn) |> List.to_string() runtime_application = Application.spec(:blogservice, :vsn)
runtime_phoenix = Application.spec(:phoenix, :vsn)
# conn conn
# |> response(:ok, |> response(:ok,
# data: %{ data: %{
# runtime: %{ runtime: %{
# elixir: runtime_elixir, elixir: to_string(runtime_elixir),
# otp: runtime_application phoenix: to_string(runtime_phoenix),
# } api: to_string(runtime_application)
# } }
# ) }
conn |> response(:ok) )
end end
end end