Fork me on GitHub
#reitit
<
2021-09-01
>
JoaquinIglesias09:09:20

Hi everyone. Hope you are having a good morning. I write you about https://github.com/metosin/reitit/issues/494. Are there any known workarounds? I've checked the commits linked by the issue submitter, and they seem to involve skipping validation. I am afraid that is an unacceptable solution for my use case. This issue is causing me a considerable roadblock. I would appreciate any update on the situation. Also I could volunteer some time to help with the resolution of this issue. Please let me know if/how I can be of any help.

m-arch09:09:29

Hello guys, I am having an issue serving static resources with a pedestal-reitit setup. this is my project.clj resource-paths :resource-paths ["config", "resources", "target/cljsbuild"] and I have added to my routes definition as following

(pedestal/routing-interceptor
   (rhttp/router
    ;;; routes-definition-here in place of []
    []
    {:exception pretty/exception
     :data {:coercion reitit.coercion.spec/coercion
            :muuntaja m/instance
            :interceptors [;; swagger feature
                           swagger/swagger-feature
                           ;; query-params & form-params
                           (parameters/parameters-interceptor)
                           ;; content-negotiation
                           (muuntaja/format-negotiate-interceptor)
                           ;; encoding response body
                           (muuntaja/format-response-interceptor)
                           ;; exception handling
                           (exception/exception-interceptor)
                           ;; decoding request body
                           (muuntaja/format-request-interceptor)
                           ;; coercing response bodys
                           (coercion/coerce-response-interceptor)
                           ;; coercing request parameters
                           (coercion/coerce-request-interceptor)
                           ;;
                           coerce-form-params
                           ;; multipart
                           (multipart/multipart-interceptor)]}})

   (ring/routes
    (ring/create-resource-handler)
    (ring/create-default-handler))
   )
the (ring/create-resource-handler) which by defaults look at public folder as per the documentation. And I have even added to pedestal settings the following
::http/resource-path "public"
Am i missing something here ? I can't figure out a way to read my app.js located under resources/public/js/app.js by pointing the js script src to js/app.js

m-arch13:09:12

I tracked down the issue in the reitit-ring code base https://github.com/metosin/reitit/blob/8694d312f86d14ac7df3fa431af7cfba6873d8d8/modules/reitit-ring/src/reitit/ring.cljc#L217 by adding another condition to the or which becomes (or (response path) (response uri) seems to work for me but i don't know if that is a bug in the code base