I'm trying to return json from a request in luminus, but I keep getting an error like java.lang.IllegalStateException: Can't coerce body of type class clojure.lang.PersistentArrayMap
but the body type is a string, not a persistent array map (I don't think)
I added these routes to the main route handler that comes configured
(defn about [request]
(-> "{\"foo\": \"bar\"}"
(response/ok)
(response/header "Content-Type" "application/json")))
(defn api-routes []
["/api"
{:middleware []}
["/about" {:get about}]])
When I hit the endpoint, I get a 500 response, and the Content-Type is octet-stream instead of json
the coercions should be handled by the middleware automatically, so you should just be able to return (response/ok {:foo :bar})
apologies for the basic question - in Luminus (or clojurescript) is there anything built-in for creating a list of files in a folder in the resources directory? Or should I reach for a npm library? thanks!