Implementing an ajax call in clojurescript

后端 未结 3 1576
广开言路
广开言路 2021-02-05 10:03

I\'m new to clojurescript and would like to do a deeper dive by implementing a previously written application purely in clojurescript, but am at a loss with respect to to implem

3条回答
  •  無奈伤痛
    2021-02-05 10:27

    An another viable option could be https://github.com/JulianBirch/cljs-ajax

    Since it's designed for ClojureScript, the syntax looks clearer and simpler. It also supports a lot of features out of the box (for example: transit, edn and json formats).

    Some examples from a README:

    (ns foo
      (:require [ajax.core :refer [GET POST]]))
    
    ...
    
    (GET "/hello" {:handler handler
                   :error-handler error-handler})
    
    (POST "/send-message"
        {:params {:message "Hello World"
                  :user    "Bob"}
         :handler handler
         :error-handler error-handler})
    

提交回复
热议问题