Sign in New API Help About

Posting to the dpaste.com API with ClojureScript

416 bytes of ClojureScript
Created 1 year ago by dpaste.com — public
Viewed 627 times
https://dpaste.com/CJS492529
COPY TO CLIPBOARD SOFT WRAP RAW TEXT DUPLICATE DIFF
(ns my-app.core
  (:require [cljs-http.client :as http]))

(defn handler [response]
  (println (:body response)))

(defn main []
  (let [data {"content" "(println (int (Math/sqrt 4092529)))" "syntax" "clojurescript"}
        headers {"Content-Type" "application/x-www-form-urlencoded"}]
    (-> (http/post "https://dpaste.com/api/" {:form-params data :headers headers})
        (js/Promise.then handler))))

Related items


Share: