This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-14
Channels
- # asami (1)
- # babashka (50)
- # beginners (70)
- # bristol-clojurians (6)
- # calva (36)
- # chlorine-clover (1)
- # cider (4)
- # clj-kondo (3)
- # cljdoc (49)
- # cljsrn (5)
- # clojure (96)
- # clojure-australia (3)
- # clojure-dev (1)
- # clojure-europe (84)
- # clojure-nl (4)
- # clojure-spec (9)
- # clojure-uk (65)
- # clojurescript (31)
- # community-development (6)
- # conjure (17)
- # cursive (8)
- # datascript (5)
- # datomic (12)
- # duct (3)
- # emacs (18)
- # figwheel-main (2)
- # fulcro (7)
- # helix (1)
- # jobs (3)
- # luminus (7)
- # off-topic (77)
- # pathom (3)
- # portal (1)
- # rdf (4)
- # re-frame (1)
- # reitit (4)
- # remote-jobs (4)
- # reveal (15)
- # rum (1)
- # sci (38)
- # shadow-cljs (22)
- # spacemacs (1)
- # specter (6)
- # sql (1)
- # test-check (1)
- # tools-deps (60)
- # vim (12)
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
(ring/ring-handler
(ring/router
[""
["/"
(fn [_]
{:status 200
:headers {"Content-Type" "text/html"}
:body (rum/render-static-markup [:html {:lang "en"}
[:head
[:title "Hello Websockets"]
[:meta {:charset "utf-8"}]
[:link {:rel "stylesheet" :href "/css/main.css"}]]
[:body
[:h1 "Hello Websockets"]
[:#app]
[:script {:src "/js/main.js"}]
[:script "ws.app.init()"]]])})]
["/chsk" {:get ring-ajax-get-or-ws-handshake
:post ring-ajax-post}]])
(ring/routes
(ring/create-resource-handler {:path "/" :root "public"})
(ring/create-default-handler
{: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
resources/
└── 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...Hello everybody! I add a new Clojure implementation using Reitit on the website http://www.todobackend.com/. You can check the repo directly here: https://github.com/PrestanceDesign/todo-backend-clojure-reitit I think that can be useful. Cheers!