This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-26
Channels
- # babashka (7)
- # beginners (85)
- # calva (39)
- # cider (3)
- # clara (1)
- # clj-kondo (10)
- # clojure (194)
- # clojure-europe (36)
- # clojure-madison (2)
- # clojure-nl (13)
- # clojure-spec (11)
- # clojure-uk (2)
- # clojurescript (17)
- # community-development (5)
- # component (9)
- # conjure (4)
- # core-async (3)
- # cursive (32)
- # data-science (26)
- # datomic (31)
- # graalvm (22)
- # holy-lambda (31)
- # honeysql (7)
- # introduce-yourself (1)
- # jobs (9)
- # jobs-rus (1)
- # lsp (3)
- # malli (9)
- # off-topic (54)
- # pathom (27)
- # pedestal (6)
- # portal (1)
- # re-frame (4)
- # releases (1)
- # remote-jobs (1)
- # sci (3)
- # shadow-cljs (4)
- # spacemacs (13)
- # vim (14)
- # xtdb (3)
Is it possible to match /foo
, /foo/
, and /foo/:bar
with one route def with optional :bar
? :thinking_face:
I defined routes :
(defn login
[request]
(log/info request))
(def routes #{["/design_unit/register" :get register :route-name :resgister]
["/design_unit/saveleader"
:get (conj inter/common-interceptors `save-leader)]
["/login" :post [inter/common-interceptors `login]]
})
but run error:
Syntax error (AssertionError) compiling at (app\server.clj:6:1).
Assert failed: In row 9, the vector of handlers should have been a bunch of interceptors but was [[#Interceptor{:name :io.pedestal.http.body-params/body-params} #Interceptor{:name :io.pedestal.http/html-body}] app.design-unit.bzarea.handler/login].
The whole route was: ["/login" :post [[#Interceptor{:name :io.pedestal.http.body-params/body-params} #Interceptor{:name :io.pedestal.http/html-body}] app.design-unit.bzarea.handler/login] :route-name :login]
(every? (fn* [p1__11405#] (satisfies? interceptor/IntoInterceptor p1__11405#)) handlers)
I'm referring to this URL http://pedestal.io/reference/routing-quick-reference
use conj is ok ,but use [] is reoprt error.that spot in the route is supposed to be either a function (`register`) or a list of interceptors. (conj inter/common-interceptors 'save-leader)
returns a list, with save-leader
at the end.
but if the common-interceptors
is [a b c]
, the broken /login
route's list looks like this [[a b c] 'login]
, which isn't right.