I would like to add an EDN parser middleware to the server generated by chestnut but I can’t seem to get it to work.
In a tutorial they do the following.
(defn parse-edn-body [handler] (fn [request] (handler (if-let [body (:body request)] (assoc request :edn-body (read-inputstream-edn body)) request)))) (def handler (-> routes parse-edn-body))
The chestnut server has
(def http-handler (if is-dev? (reload/wrap-reload (api #'routes)) (api routes)))
I’m not sure how this middleware stuff works or where to add the EDN parser. Any help would be appreciated.