Fork me on GitHub
Jacob Rosenzweig00:10:08

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

(def app
  (wrap-defaults all-routes site-defaults))
(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")))

Jacob Rosenzweig00:10:15

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


Ps do you have a brother named Paul

Jacob Rosenzweig00:10:08

If he shares the last name as me though, we could always play "Jewish Geography" and find out if I know him lol.

Jacob Rosenzweig00:10:39

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.

Jacob Rosenzweig00:10:04

I also forgot to wrap my response in the (response) function. Maybe I'll remember that step one day


Haha. Check out the source of the not found route. I think you’ll see why it is matching


With core.async is there a convention of how a "global" timeout channel is called?