When using the table routing syntax, what is the suggested way of applying a seq of interceptors to e.g. all routes under a given path?
I had thought that registering the interceptors as metadata in a wrapping vector would do it but that seems not to be true
Hi @donaldball! You can create a var bound to the vector of common interceptors and conj
your handler into it. With the table routing syntax, you’ll need to do this for each route
A project created using the service template will have an example of this
(def common-interceptors [(body-params/body-params) http/html-body])
;; Tabular routes
(def routes #{["/" :get (conj common-interceptors `home-page)]
["/about" :get (conj common-interceptors `about-page)]})
Yeah, that’s what I’m doing now, but it’s ergonomically less appealing than earlier syntaxes allowed. Then again, that’s what fns are for. 🙂