Fork me on GitHub

Hi. I don’t quite get the use of enable-console-print!. The docs says it binds print-fn to console.log. So does that mean, if we do not do that, the (println) messages won’t be shown?


For example, if you’re developing a web app, print messages will be shown in your REPL, but not in the browser’s devtools console if you don’t enable-console-print!. Regardless you can still print to the console manually by using js/console.log.


What about production release where there is no REPL?


Basically without a print function set to output to the web/Node console (i.e. console.log), print statements will not print to console 🙅


@UGC0NEP4Y enable-console-print! is no longer required as of ClojureScript 1.10


oops. that’s from an old thread dating backing to 2018.


Should clojure.edn/read-string create js/BigInts when the number has an "N" suffix (running on Node.js target)

(type (edn/read-string "1N")) => #object[Number]
Looking at this for integers > (.-MAX_SAFE_INTEGER js/Number) it still produces only Numbers, never BigInts. In clojure, integers with an N" suffix will create clojure.lang.BigInt`s, and I notice that other edn parsers for javascript do the same. But clojurescript itself seems to lose precision for clojure.edn/read-string


Printing a js/BigInt is straight forward:

(extend-protocol IPrintWithWriter
  (-pr-writer [n writer opts]
    (-write writer (str n "N"))))
But I can't read them back in using read-string (without losing precision anyway)


There's a library called edn-data ( Using this library, which contains a parseEdnString function:

(def parse-edn-string (.-parseEDNString edn-data))                                                                                                      (type (parse-edn-string "1N")) => #object[BigInt]
we'll get a js/BigInt.


After a lot of frustrations finally I got the model how (actually, contrintuitive imho) Compojure calls middlewares, and want to share maybe the only (?) solution worked the way it shoul be 😊

(defroutes app-routes
  (-> public-routes
      (wrap-routes wrap-parse-params-body))

  (-> secured-routes
      (wrap-routes wrap-parse-params-body)
      (wrap-routes wrap-authentication))

  (-> mobile-routes
      (wrap-routes wrap-parse-params-body)
      (wrap-routes wrap-mobile-authentication))

  (-> (route/resources "/")
      (wrap-routes wrap-authentication)) ;; all resources are private for direct access (load from html etc.)!

  (-> (ANY "*" [] {:status 404}) ;; (route/not-found {:status 404}) doesn't call wrap-authentication!
      (wrap-routes wrap-authentication)))

(def handler
  (-> app-routes
PS yes, I had to wrap them all with wrap-routes and triplicate wrap-parse-params-body etc.