Fork me on GitHub
#graphql
<
2018-12-10
>
devth18:12:03

i'm not seeing an obvious choice for a gql client in clojure. can anyone recommend one?

Joe Lane19:12:09

in clojure or clojurescript?

timgilbert22:12:11

You might take a look at artemis, which aims to be kind of a minimalist cljs apollo: http://docs.workframe.com/artemis/current/index.html

devth22:12:51

@timgilbert thanks, but looking for clojure, not cljs @joe.lane clojure

devth22:12:21

here's my poor man's client 😂

(defn graphql [query]
  (client/post
    (-> (config) :graphql :endpoint)
    {:headers {"Authorization" (str "bearer " (:token (config)))}
     :body (str "{\"query\": \"" (s/replace query #"\n" "") "\"}")
     :as :json}))

timgilbert22:12:47

Oh, I see. I don't know of one for the client-side on the JVM

timgilbert22:12:04

...that seems reasonable

devth22:12:12

lol. yeah it's not too complicated

devth22:12:27

but a true lib would be convenient

timgilbert22:12:37

Yeah. One thing you might be interested is that if you've got Clojure on both sides you can use EDN or transit as the wire format, which can save a few headaches with keyword conversions etc.

devth22:12:06

yep already hitting escaping issues 😖 but i'm hitting github graphql api so i don't have the choice

timgilbert22:12:07

Doesn't help if you need to interop with javascript etc though