Hi, how can I write the following curl in Elixir?
def get_host_name(), do: {:ok, _hostname} = :inet.gethostname()
def get_info() do
System.cmd("curl", ~w[-X GET http://#{get_host_name()}:6666/info]
end
I have tried this and it seems to work as well but It takes lots of time to compute. Also, how can I store the result of the curl in form of a map and throw an error if it is not valid JSON?