neuron v0.8.0 Neuron
Neuron is a GraphQL client for elixir.
Usage
iex> Neuron.Config.set(url: "https://example.com/graph")
iex> Neuron.Config.set(headers: [hackney: [basic_auth: {"username", "password"}]])
iex> Neuron.query("""
{
films {
title
}
}
""")
# Response will be:
{:ok, %Neuron.Response{body: %{"data" => {"films" => [%{"title" => "A New Hope"}]}}%, status_code: 200, headers: []}}
# You can also run mutations
iex> Neuron.mutation("YourMutation()")
Summary
Functions
runs a mutation request to your graphql endpoint
runs a query request to your graphql endpoint