Note. I am an experienced programmer in general and using clojure, but have never done any serious web development.
I installed the base ClojureScript project using Chestnut and went through the "Hello World" steps just fine. However, I would really like to talk with my backend. To do this, I redefined the reagent code
(defn greeting []
[:input {:type "button"
:value (:text @app-state)
:on-click
Which gets 404 response when clicked. At least I'm talking to someone. I also see evidence of my receive requests in the server.log file. However, at the moment I am struggling with several conceptual points.
First of all, http / get is a function defined in clj-http.client that was not part of the Chestnut setup. It seems that I am no longer aware if I need to go in search of libraries to send something basic, like a request for receipt.
Secondly, the file for the user namespace has the following lines, predefined by chestnut:
(def http-handler
(wrap-reload
(defn run []
(figwheel/start-figwheel!))
I do not see the place where the http handler is ever used. Therefore, I do not understand what such a definition even makes.
, , Figwheel, "run", -, a) index.html b) TCP- JavaScript . . , , , Figwheel API, .
, , http-, mypage/server.clj(), - , get, , . , , get-request, , Figuheel-, . , - http, .
(defroutes routes
(GET "/" _
{:status 200
:headers {"Content-Type" "text/html; charset=utf-8"}
:body (io/input-stream (io/resource "public/index.html"))})
(resources "/"))
(def http-handler
(-> routes
(wrap-defaults api-defaults)
wrap-with-logger
wrap-gzip))