This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-09
Channels
- # aleph (16)
- # bangalore-clj (1)
- # beginners (57)
- # cider (4)
- # clara (1)
- # cljs-dev (25)
- # cljsrn (12)
- # clojure (76)
- # clojure-dusseldorf (2)
- # clojure-italy (41)
- # clojure-russia (4)
- # clojure-spec (3)
- # clojure-uk (122)
- # clojurescript (101)
- # cursive (8)
- # data-science (30)
- # datomic (2)
- # emacs (2)
- # figwheel (10)
- # fulcro (53)
- # garden (5)
- # gorilla (6)
- # hoplon (1)
- # jobs (1)
- # juxt (14)
- # leiningen (12)
- # om (1)
- # om-next (1)
- # onyx (21)
- # pedestal (40)
- # perun (5)
- # portkey (2)
- # re-frame (16)
- # reagent (1)
- # ring-swagger (3)
- # rum (6)
- # shadow-cljs (239)
- # spacemacs (10)
- # specter (9)
- # uncomplicate (2)
- # unrepl (1)
- # vim (13)
- # yada (16)
Multimethods are simple clojure functions, so yes, you can, but it need to receive request and return response
And you may need to make some routes to it
["/foo" :get my-mm :route-name ::mm]
["/bar" :get my-mm :route-name ::mm*]
@zallin You probably have to supply a route name in order to make the routes unique, too.
when using mm as handler i get an error "You're trying to use something as an interceptor that isn't supported by the protocol; Perhaps you need to extend it?"
is it possible to combine router instances? ex have a router based on map tree that contains a leaf with linear and another branch at some level using map tree?
I just wrote a bit about that in a new guide: http://pedestal.io/guides/what-is-an-interceptor#_some_practical_applications
actually I have a use case for it now that I think of it: i might have to switch to linear router on some cases where there is ambiguity with other routers: ex /foo/:id/ followed by a /foo/bar/ route
Yeah, I’ve got a similar case. The API was defined and released long ago. So we’re kind of stuck with the linear router
That’s interesting. I haven’t heard of anyone doing that before. What are you using to accept HTTP requests? And what are you using for routing now?
jetty 9 but we have a lot of internals that rely on old tricks and we do things differently with ws
yes more or less. we have a resource abstraction that can load an interceptor chain and use it