Files
blog-service/lib/blogservice_web/controllers/version_controller.ex
sophiathedev c2a192d499 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
2025-12-07 16:33:12 +07:00

21 lines
522 B
Elixir

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