This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-31
Channels
- # architecture (5)
- # beginners (35)
- # boot (150)
- # cider (1)
- # clara (7)
- # cljs-dev (131)
- # cljsrn (10)
- # clojure (76)
- # clojure-austin (3)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-chicago (2)
- # clojure-dusseldorf (1)
- # clojure-italy (30)
- # clojure-nl (2)
- # clojure-russia (40)
- # clojure-serbia (2)
- # clojure-spec (25)
- # clojure-uk (13)
- # clojured (2)
- # clojurescript (106)
- # core-async (29)
- # datascript (65)
- # datomic (38)
- # emacs (8)
- # funcool (8)
- # hoplon (6)
- # jobs (3)
- # klipse (93)
- # luminus (16)
- # lumo (4)
- # off-topic (2)
- # om (11)
- # onyx (13)
- # pedestal (4)
- # protorepl (3)
- # re-frame (40)
- # reagent (31)
- # ring (6)
- # ring-swagger (4)
- # slack-help (5)
- # spacemacs (13)
- # untangled (17)
- # vim (2)
[metosin/compojure-api "1.2.0-alpha3”]
is out: class-based exception handling, latest Muuntaja and the inline help.
@borkdude you can now list all the restructuring keys with descriptions from repl. The :middleware
example:
(require '[ :as help])
(help/help :meta :middleware)
------------------------------------------------------------
:middleware
Applies the given vector of middleware to the route.
Middleware is presented as data in a Duct-style form:
1) ring mw-function (handler->request->response)
2) mw-function and it's arguments separately - mw is
created by applying function with handler and args
(defn require-role [handler role]
(fn [request]
(if (has-role? request role)
(handler request)
(unauthorized))))
(def require-admin #(require-role % :admin))
(GET "/admin" []
:middleware [require-admin]
(ok))
(GET "/admin" []
:middleware [[require-role :admin]]
(ok))
(GET "/admin" []
:middleware [#(require-role % :admin)]
(ok))