Fork me on GitHub

does reitit have any facilities for referring to path/query params within the route data structure itself?


in particular I'm trying to work with a fn as data (part of route data), do something to it based off a query param, then call the fn, without using eval (seems to not really be a good option in cljs)


Getting 404s when requesting static assets in my super-basic throwaway project (playing around w/ Websockets/Sente):

(def app
      (fn [_]
        {:status 200
         :headers {"Content-Type" "text/html"}
         :body (rum/render-static-markup [:html {:lang "en"}
                                           [:title "Hello Websockets"]
                                           [:meta {:charset "utf-8"}]
                                           [:link {:rel "stylesheet" :href "/css/main.css"}]]
                                           [:h1 "Hello Websockets"]
                                           [:script {:src "/js/main.js"}]
                                           [:script ""]]])})]

     ["/chsk" {:get ring-ajax-get-or-ws-handshake
               :post ring-ajax-post}]])

    (ring/create-resource-handler {:path "/" :root "public"})
     {:not-found (constantly {:status 404
                              :headers {"Content-Type" "textplain; charset=utf-8"}
                              :body "Not Found"})}))))
Here are my resources (minus CLJS noise) and some requests for them:
$ tree resources/ -I cljs-runtime
└── public
    ├── css
    │   └── main.css
    ├── index.html
    └── js
        ├── main.js
        └── manifest.edn

3 directories, 4 files
$ curl localhost:8008/css/main.css
Not Found
$ curl localhost:8008/js/main.js
Not Found
Requesting / works as expected, minus the subsequent resource requests failing of course... I feel like I'm missing something obvious...

Michaël Salihi20:10:51

Hello everybody! I add a new Clojure implementation using Reitit on the website You can check the repo directly here: I think that can be useful. Cheers!