This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-06
Channels
- # announcements (1)
- # babashka (118)
- # beginners (108)
- # calva (20)
- # chlorine-clover (3)
- # clara (10)
- # clj-kondo (47)
- # cljsrn (10)
- # clojure (144)
- # clojure-australia (5)
- # clojure-czech (2)
- # clojure-dev (11)
- # clojure-europe (94)
- # clojure-france (4)
- # clojure-nl (5)
- # clojure-spec (3)
- # clojure-sweden (2)
- # clojure-uk (11)
- # clojuredesign-podcast (5)
- # clojurescript (56)
- # cloverage (1)
- # code-reviews (6)
- # conjure (1)
- # cursive (13)
- # datascript (1)
- # datomic (16)
- # defnpodcast (1)
- # emacs (1)
- # etaoin (1)
- # events (7)
- # fulcro (21)
- # graalvm (3)
- # helix (17)
- # jackdaw (3)
- # jobs-discuss (2)
- # lambdaisland (2)
- # london-clojurians (2)
- # meander (2)
- # mid-cities-meetup (2)
- # midje (1)
- # off-topic (1)
- # pathom (3)
- # pedestal (12)
- # reagent (7)
- # reitit (15)
- # reveal (12)
- # shadow-cljs (6)
- # sql (14)
- # test-check (3)
- # vim (13)
@abdullahibra i can reproduce that error with code below. you have to put :route-name
before :constraints
(defn respond-hello
""
[request]
{:status 200 :body "Hello, world"})
(defn greet
[req] {:status 200 :body "Greet"})
(def routes
(route/expand-routes
#{["/hello" :get [respond-hello] :route-name :hello]
["/greet/:id" :get [{:name :greet :enter greet}]
:constraints {:id #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"}
:route-name :greet ]}))
error:
#error {
:cause "Assert failed: In row 2, there were unused elements (:route-name :greet).\nThe whole route was: [\"/greet/:id\" :get [{:name :greet, :enter #function[mavp.foo/greet]}] :constraints {:id #\"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"} :route-name :greet]\n(empty? (:remaining ctx))"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "Syntax error macroexpanding at (form-init15957751344353533874.clj:15:3)."
:data #:clojure.error{:phase :execution, :line 15, :column 3, :source "form-init15957751344353533874.clj"}
@mavbozo perfect, Thank you 🙂
https://www.eclipse.org/jetty/javadoc/9.4.32.v20200930/org/eclipse/jetty/servlets/DoSFilter.html
(-> {::http/routes (if (config/production? config)
(routes system)
(fn [] (routes system)))
::http/port (config/server-port config)
::http/host (if (config/production? config)
"0.0.0.0"
"localhost")
::http/type :jetty
...}
(add-servlet-filter {:filter DoSFilter}))