I'm struggling to get static resources working with reitit and http-kit. Requesting /
returns the expected "ok!" response but requesting /js/app.js
(which is definitely there, in the public
dir) returns the 404 Not Found
response:
(ns rtc.server
(:require
[org.httpkit.server :as http]
[reitit.ring :as ring]))
(defn handler [_]
{:status 200
:headers {"Content-Type" "text/html; charset=utf-8"}
:body "ok!"})
(def app (ring/ring-handler
(ring/router
[["/" {:get handler}]
["/ping" (constantly {:status 200 :body "ok"})]])
(ring/routes
(ring/create-resource-handler {:path "/"})
(ring/create-default-handler
{:not-found (constantly {:status 404
:headers {"Content-Type" "text/plain; charset=utf-8"}
:body "Not Found"})}))))
(defonce stop-fn (atom nil))
(defn start [& [opts]]
(let [port (:port opts 3000)]
(reset! stop-fn (http/run-server app {:port port})))
nil)
Any tips for how to debug?@ctamayo hi, so you have /resources/public/js/app.js
defined?
the file lives at /public/js/app.js
, there's no resources dir in this project. Is that the issue?
resource-handler reads files from classpath, a convention is to use resources
folder for that.