Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Hello API notes

notebook.livemd

Hello API notes

Mix.install([
  {:kino, "~> 0.16.0"},
  {:merquery, "~> 0.3.0"}
])

Node info

%{
  node: Node.self(),
  cookie: Node.get_cookie(),
  nodes: Node.list()
} |> Kino.Tree.new

Access fly-io app

hi@hello-api-elixir.internal node

require Kino.RPC
node = :"hi@hello-api-elixir.internal"
Node.set_cookie(node, :hello)
Kino.RPC.eval_string(node, ~S":ok", file: __ENV__.file)

Remote execution in orb-container

Access node in orb container with hi@hello-api-elixir.orb.local

require Kino.RPC
node = :"hi@hello-api-elixir.orb.local"
Node.set_cookie(node, :hello)
Kino.RPC.eval_string(node, ~S"HelloApi.info", file: __ENV__.file)

API request

req =
  Req.new(
    method: :get,
    url: "http://hello-api-elixir.orb.local",
    headers: %{},
    params: %{}
  )
{req, resp} = Req.request(req)
resp
resp.body