I'm serving up some html and js content, and using handler/site for that. I have a separate handler/api group of routes under the "/api" context.
If I include the api routes before the site routes, the site works fine. If the www routes come first, the api calls fail, probably because the (route/resources "/") at the end of the site routes catches that call and returns null. OTOH, if I try to use friend with the api routes, it breaks the friend wrapping of the www calls. (defroutes api-routes (context "/api" [] ..... (route/not-found "ERROR"))) (defroutes www-routes (GET "/admin" req (friend/authorize #{::admin} "Admin only")) (GET "/authorized" req (friend/authorize #{::user} "Users only")) (GET "/home" [] (response/file-response "home.html" {:root "resources/public"})) (GET "/login" [] (response/file-response "login.html" {:root "resources/public"})) (friend/logout (ANY "/logout" req (response/redirect "/"))) (GET "/" [] (response/redirect "index.html")) (route/resources "/") (route/not-found "Not Found")) (def app (routes (-> www-routes (friend/authenticate {;:allow-anon? true ;;:login-uri "/login.html" ;:default-landing-uri "/" ;:redirect-on-auth? "/home" ;:unauthorized-handler #(response/status (response/response "NO") 401) ;:login-failure-handler #(response/response "OOPS") :credential-fn (partial creds/bcrypt-credential-fn users) :workflows [(workflows/interactive-form)]}) ;;(wrap-resource "public") ;wrap-content-type ;wrap-not-modified ;;wrap-reload handler/site) (-> api-routes handler/api ;;wrap-reload wrap-restful-format))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.