This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-22
Channels
- # beginners (10)
- # boot (134)
- # cider (29)
- # clara (2)
- # cljs-dev (10)
- # cljsjs (2)
- # cljsrn (13)
- # clojure (76)
- # clojure-india (4)
- # clojure-ireland (1)
- # clojure-russia (20)
- # clojure-spec (11)
- # clojure-uk (7)
- # clojurescript (88)
- # core-async (5)
- # core-logic (3)
- # cursive (17)
- # datascript (5)
- # datomic (123)
- # hoplon (8)
- # klipse (6)
- # lambdaisland (2)
- # leiningen (4)
- # luminus (2)
- # off-topic (23)
- # om (23)
- # om-next (1)
- # onyx (20)
- # pedestal (2)
- # perun (2)
- # re-frame (11)
- # ring-swagger (3)
- # untangled (12)
hey @edwthomas, finally got it working, thanks a lot guys for the hints! 😄 JS:
fetch("")
.then(function (response) {return response.json();})
.then(function (responseJSON) {return responseJSON.title;})
.then(function (result) {console.log(result)});
CLJS:
(->
(js/fetch "")
(.then (fn [response] (.json response)))
(.then (fn [response-json] (:title (js->clj response-json :keywordize-keys true))))
(.then (fn [result] (prn result))))
it also works without js->clj
which I don't know if it makes sense (or probably only because I was logging it)
...
(.then (fn [response-json] (.-title response-json)))
...
@ejelome I recommend playing around with fetch in lumo, it's easier than working in a simulator
will look into that @peterschwarz, thanks 😄
btw, where do you usually play with REST, do you create a simple script or is there a place where we can play with GET/POST/PUT/DELETE etc.
@ejelome If you just want to test hitting an API and seeing the results in a friendly way check out Postman: https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop
I don't understand @ejelome
I usually play around with https://echo.getpostman.com/ first, from the repl
oks, will try this out, thanks @pesterhazy 😄
not peterschwarz but 👍