Created
September 28, 2017 04:21
-
-
Save swlkr/584160c1365943384355d69c5f87b1fd to your computer and use it in GitHub Desktop.
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
| (def protected-routes (-> (get "/" (fn [r] "GET /")) | |
| (get "/sign-out" (fn [r] "GET /sign-out")))) | |
| (defn middleware [handler] | |
| (fn [request] | |
| (if (= 1 2) | |
| (handler request) | |
| (throw (Exception. "Nope"))))) | |
| (def routes (-> (wrap-routes middleware protected-routes) | |
| (get "/sign-up" (fn [r] "GET /sign-up")) | |
| (post "/users" (fn [r] "POST /users")) | |
| (put "/users/:id" (fn [r] "PUT /users")) | |
| (patch "/users/:user-id" (fn [r] "PATCH /users")) | |
| (delete "/users/:uid" (fn [r] "DELETE /users")) | |
| (not-found (fn [r] "not found")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment