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 To Integrate Clojure Web Applications in Apache

I use a combination of the following to make this fairly painless: Cake (incl. the deploy command) A Cake template for webprojects developed by Lau Jensen. Vagrant (Ruby VM(Virtualbox) management tool, which relies on Chef or Puppet) VPS (from Slicehost) The key part is the webdev template that Lau made. The webdev folder should be … Read more

What’s the “big idea” behind compojure routes?

Compojure explained (to some degree) NB. I am working with Compojure 0.4.1 (here‘s the 0.4.1 release commit on GitHub). Why? At the very top of compojure/core.clj, there’s this helpful summary of Compojure’s purpose: A concise syntax for generating Ring handlers. On a superficial level, that’s all there is to the “why” question. To go a … Read more