This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-18
Channels
- # announcements (2)
- # aws (3)
- # beginners (35)
- # boot (10)
- # cider (33)
- # cljs-dev (22)
- # clojure (58)
- # clojure-belgium (1)
- # clojure-europe (8)
- # clojure-houston (1)
- # clojure-italy (47)
- # clojure-nl (2)
- # clojure-spec (4)
- # clojure-uk (39)
- # clojurescript (12)
- # cursive (18)
- # data-science (1)
- # datomic (2)
- # emacs (24)
- # figwheel-main (29)
- # fulcro (24)
- # hoplon (14)
- # juxt (6)
- # kaocha (3)
- # nrepl (6)
- # off-topic (64)
- # om (1)
- # om-next (1)
- # pathom (21)
- # pedestal (18)
- # planck (40)
- # protorepl (1)
- # re-frame (15)
- # reagent (7)
- # reitit (16)
- # shadow-cljs (184)
- # spacemacs (4)
- # test-check (33)
@colliderwriter I idea more. I think there could be just a generic wrapper that could be used to wrap the Sieppari-style error interceptors. e.g.
;; with Sieppari
:interceptors [(exceptions/exception-interceptor)]
;; with Pedestal
:interceptors [(reitit.pedestal/interceptor (exceptions/exception-interceptor))]
would that be possible? would be a generic solution for future too.and actually, the wrapping could automatic here: https://github.com/metosin/reitit/blob/master/modules/reitit-pedestal/src/reitit/pedestal.clj#L16. e.g. if the interceptor has :error
of 1-arity…
https://stackoverflow.com/questions/1696693/clojure-how-to-find-out-the-arity-of-function-at-runtime
interceptors get compiled once, on router creation, so there is no runtime perf penalty, besides some interceptors having a extra wrapper.
hi all, is there a way to escape colons in a path? for dev, i’m running some server in a specific port, so i have something like "
, but i’m running into some errors, and I realized the colon might be interpreted as a parameter.
Scratch that, it seems the problem is simply having a route parameter when the root isn’t /
. Is there any particular reason why
Routes must start from the root, so they must begin with a '/'
?
@levitanong that is a bad constraint from the past, should be removed
> :uri (Required, String) > The request URI, excluding the query string and the "?" separator. > Must start with "/".
@ikitommi i’m writing a server in nodejs though, so it’s not ring 😛 And besides, I see value in allowing non-“/”, in cases where you want your server to connect to an external resource as a client.
Not sure where the check currently is, or if there even is a check and reitit just doesn't work, but if there is a check, it should be moved to reitit-ring module. And I don't see how "cases where you want to server to connect to an external resource" relates to Reitit?
@juhoteperi i find it handy to use the reitit data structure to move routes to config. Consider the case where my group is developing both a set of microservices and a project that consumes these microservices. The project will have its own develop/staging/master deployments and likewise for the other microservices. Needless to say, we don’t want something in develop interacting with something in master. reitit helps me solve this problem by associating a URL with a route name. In my networking code, I can just worry about dealing with that route name, and assume the it will go to the right URL.
@juhoteperi @ikitommi the check is here: https://github.com/metosin/reitit/blob/f1cbeaa7d280a276eca56f3946c65bfb3ad95472/modules/reitit-core/src/reitit/impl.cljc#L85
@vale ok, that is fixed in the Trie PR (waiting for internal review): https://github.com/metosin/reitit/blob/347be863dfb0ddb7e6d0832fcf10cb059deff51c/modules/reitit-core/src/reitit/impl.cljc#L15-L21
Is there a way to specify spec-coerced query parameters so they are optional? or to allow lists in body parameters? I get coercion errors
(s/def ::maybe-int? (s/or :int integer? :nil nil?))
(s/conform ::maybe-int? nil)
;;
(s/def ::vec-two-strings (s/cat :one string? :two string?) )
(s/conform ::vec-two-strings '["tom" "sam"])