luminus

Jacob Rosenzweig 2021-07-21T02:06:10.050500Z

Is there a simple way to add a camelCase -> kebab-case middleware into luminus for my POST requests? Right now I have something like this:

(def instance
  (m/create
    (-> m/default-options
        (update-in
          [:formats "application/transit+json" :decoder-opts]
          (partial merge time/time-deserialization-handlers))
        (update-in
          [:formats "application/transit+json" :encoder-opts]
          (partial merge time/time-serialization-handlers))
        (update-in
          [:formats "application/json" :encoder-opts]
          (partial merge #(name (csk/->camelCase %))))
        (update-in
          [:formats "application/json" :decoder-opts]
          (partial merge #(keyword (csk/->kebab-case %)))))))
But it's obviously not working.

Jacob Rosenzweig 2021-07-21T02:45:11.050900Z

I almost had it! I didn't add the anonymous function to the right key.

(def instance
  (m/create
    (-> m/default-options
        (update-in
          [:formats "application/transit+json" :decoder-opts]
          (partial merge time/time-deserialization-handlers))
        (update-in
          [:formats "application/transit+json" :encoder-opts]
          (partial merge time/time-serialization-handlers))
        (update-in
          [:formats "application/json" :encoder-opts]
          (partial merge {:encode-key-fn #(name (csk/->camelCase %))}))
        (update-in
          [:formats "application/json" :decoder-opts]
          (partial merge {:decode-key-fn #(keyword (csk/->kebab-case %))})))))

rnandan273 2021-07-21T11:06:08.052500Z

Created new luminus fullstack app, however the shadow-cljs watch app command shows up an error, Any ideas?

javahippie 2021-07-21T11:19:00.053100Z

What error do you get? Which command exactly did you type?

rnandan273 2021-07-21T12:26:57.053300Z

shadow-cljs watch app, it says cannot bind to port 9630, actually nothing is running on that port

rnandan273 2021-07-21T12:27:30.053500Z

however shadow-cljs compile app runs, so it is a issue with port, where do we set another port?

javahippie 2021-07-21T15:52:25.053700Z

Is the backend working (port 3000)? Just to check that the process is allowed to open ports at all

rnandan273 2021-07-21T11:06:36.053Z

this was created using lein new luminus +re-frame +http-kit

rnandan273 2021-07-21T16:14:52.054300Z

Issue with lein script, updated to 2.9.6 and things started working