Compojure routes with different middleware

(defroutes user-routes* (GET “-endpoint1” [] (“USER ENDPOINT 1”)) (GET “-endpoint2” [] (“USER ENDPOINT 1”))) (def user-routes (-> #’user-routes* (wrap-basic-authentication user-auth?))) (defroutes admin-routes* (GET “-endpoint” [] (“ADMIN ENDPOINT”))) (def admin-routes (-> #’admin-routes* (wrap-basic-authentication admin-auth?))) (defroutes main-routes (ANY “*” [] admin-routes) (ANY “*” [] user-routes) This will run the incoming request first through admin-routes and then through … Read more

How do I stop jetty server in clojure?

I usually have a line in my Ring app that looks like the following: (defonce server (run-jetty #’my-app {:port 8080 :join? false})) This prevents locking up the REPL. It also allows me to recompile this file without worrying that my server will get redefined. It also lets you interact at the REPL like so: user=> … Read more