Let me clarify. I removed the 'not-found' route and the api calls all return an empty response.
-- Jonathon McKitrick On Thu, Aug 7, 2014 at 3:14 PM, Jonathon McKitrick <jmckitr...@gmail.com> wrote: > Right, I tried removing that as well, and Friend still fails, and the api > routes fail as well. > > > -- > Jonathon McKitrick > > > On Thu, Aug 7, 2014 at 2:54 PM, James Reeves <ja...@booleanknot.com> > wrote: > >> Compojure routes are checked in order until one matches. You've set up >> your www-routes to match all possible routes, as you have a "catch-all" >> not-found route at the bottom. >> >> - James >> >> >> On 7 August 2014 13:17, Jonathon McKitrick <jmckitr...@gmail.com> wrote: >> >>> 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. >>> >> >> -- >> 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 a topic in the >> Google Groups "Clojure" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/clojure/A-qRAftd6XY/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.