How to Fetch a GET request like in Javascript

From ElixirBlocks
Revision as of 01:02, 29 August 2025 by Admin (talk | contribs) (Created page with " <source> defmodule App do # Install Req from hex def fetch do task = Task.async(fn -> Req.get!("https://api.github.com/repos/wojtekmach/req") end) Task.await(task) end end </source>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
defmodule App do
 # Install Req from hex
  def fetch do
       task =  Task.async(fn -> Req.get!("https://api.github.com/repos/wojtekmach/req") end)
       Task.await(task)

  end
end