Created
July 21, 2013 23:20
-
-
Save manutter51/6050382 to your computer and use it in GitHub Desktop.
The right way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ... | |
(defn- lock [handler] | |
(friend/requires-scheme handler :https {:http 3333 | |
:https 3334})) | |
(defroutes sensitive-routes | |
(GET "/register" [] | |
(layout/render "auth/register.html")) | |
(GET "/login" [] | |
(layout/render "auth/login.html")) | |
(POST "/login" [email pass] | |
(login email pass)) | |
(POST "/register" [email pass pass1] | |
(register email pass pass1))) | |
(defroutes auth-routes | |
(GET "/logout" [] | |
(logout)) | |
(POST "/logout" [] | |
(logout)) | |
(lock sensitive-routes)) | |
;; ============================== | |
;; and in handler.clj: | |
(defroutes | |
app-routes | |
(route/resources "/") | |
(route/not-found "Not Found")) ; TODO: make this its own page | |
(def all-routes [cljs-routes home-routes | |
error-routes auth-routes app-routes]) | |
(def app | |
(middleware/app-handler all-routes | |
:access-rules [])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment