Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defonce stories (atom []))
- (defn handle-story-data [resp]
- (let [{:keys [id title url]} resp]
- (swap! stories conj {:id id :title title :url url})))
- (defn get-story-data [id]
- (GET (str "https://hacker-news.firebaseio.com/v0/item/" id ".json")
- {:handler handle-story-data
- :response-format :json
- :keywords? true}))
- (defn handle-story-ids [resp]
- (let [ids (take 30 resp)]
- (doseq [id ids]
- (get-story-data id))))
- (defn get-story-ids []
- (GET "https://hacker-news.firebaseio.com/v0/topstories.json"
- {:handler handle-story-ids
- :response-format :json}))
- (get-story-ids)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement