Fork me on GitHub
#reitit
<
2022-09-22
>
Akiz18:09:32

Hi, i need reitit to serve index.html (/resources/public/index.html) on “/”. But i am getting 404. I am sure i am missing something obvious but i cant spot it 😔. These are my deps.edn paths :paths ["src" "resources" "target/classes"] and this is the code:

(defn main-routes [db]
  (ring/router
   ["/"
    ["api" …]]
   {:data {:muuntaja m/instance
           :coercion reitit.coercion.malli/coercion
           :middleware [muuntaja/format-middleware
                        mw/wrap-format
                        rrc/coerce-exceptions-middleware
                        rrc/coerce-request-middleware
                        rrc/coerce-response-middleware
                        exception/exception-middleware]}}))

(defn app [db]
  (ring/ring-handler
   (main-routes db)
   (ring/routes
    (ring/create-resource-handler {:path "/"})
    (ring/create-default-handler)))) 

wevrem20:09:04

Does it work as expected on “/index.html”?

Akiz04:09:35

No, but I found it. The code above is fine, I had a wrong profile defined in deps.edn, so no resources worked 🙃