This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-24
Channels
- # babashka (2)
- # beginners (10)
- # calva (30)
- # cljs-dev (3)
- # clojure (40)
- # clojure-europe (8)
- # clojure-france (1)
- # clojure-portugal (1)
- # conjure (4)
- # cursive (12)
- # datalevin (2)
- # introduce-yourself (5)
- # lsp (16)
- # off-topic (33)
- # re-frame (3)
- # rewrite-clj (31)
- # ring (3)
- # shadow-cljs (6)
- # specter (4)
- # tools-deps (8)
- # vim (17)
Kind of stupid but can someone point out the reason why
results in a 404 but
does not? Here's my code:
handler.clj
(ns board-manager.handler
(:require [compojure.core :refer :all]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
[ring.adapter.jetty :as ring-jetty]
[board-manager.routes.threads :as threads]))
(defroutes app-routes
(GET "/test" [] "Hello Test")
(route/not-found "Not Found"))
(def all-routes
(routes
app-routes
threads/thread-routes))
(def app
(wrap-defaults all-routes site-defaults))
routes\threads.clj:
(ns board-manager.routes.threads
(:require [compojure.core :refer :all]
[compojure.route :as route]))
(defroutes thread-routes
(context "/threads" []
(GET "/test" [] {:key "value"})
(route/not-found "Not Found")))
If I remove app-routes
from all-routes
it starts working... routes
must not be doing what I want it to do.
I think it’s because your app routes checks for test and otherwise always returns 404. Later routes cannot match because the app routes already matched the 404
I do not.
If he shares the last name as me though, we could always play "Jewish Geography" and find out if I know him lol.
I did not know that it runs through the routes linearly, thought it'd check all routes before defaulting to the 404. Oh well, makes sense.
I also forgot to wrap my response in the (response)
function. Maybe I'll remember that step one day