This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-04
Channels
- # announcements (5)
- # beginners (205)
- # calva (1)
- # cider (48)
- # cljs-dev (9)
- # clojure (123)
- # clojure-berlin (1)
- # clojure-europe (2)
- # clojure-italy (5)
- # clojure-nl (6)
- # clojure-russia (7)
- # clojure-serbia (1)
- # clojure-spec (8)
- # clojure-uk (33)
- # clojurescript (134)
- # cursive (5)
- # datomic (31)
- # emacs (5)
- # figwheel-main (61)
- # fulcro (10)
- # hyperfiddle (23)
- # jobs-discuss (24)
- # klipse (1)
- # lein-figwheel (3)
- # midje (5)
- # nyc (1)
- # parinfer (2)
- # pathom (14)
- # pedestal (12)
- # re-frame (46)
- # shadow-cljs (24)
- # spacemacs (1)
- # tools-deps (37)
- # vim (4)
- # yada (22)
hmm. i’m playing around with pedestal and failing at pretty much step one. what the heck is going on here?
(defn index [req]
{:status 200
:body "hi"})
(def routes
(route/expand-routes
#{["/foo" :get index :route-name :index]}))
(http/create-server {:routes routes
:type :jetty
:port port})
@U0W0JDY4C can you point me to the docs you are following? The service map keys need to be fully-qualified keywords (i.e., io.pedestal.http/routes
or, if you have io.pedestal.http
aliased to something like http
then ::http/routes
, etc…)
I’d also assoc ::http/join? false
to the service map when so that you can stop the server when running from a repl
Finally, I’d not invoke expand-routes
directly. That’s done for you by the io.pedestal.http/default-interceptors
fn when create-server
is invoked. Your routes should instead be
(def routes
#{["/foo" :get `index :route-name :index]})
:thumbsup: i was working off the http://pedastal.io/guides , but i see now that the ::http/
was missing
Just an FYI, I went back and looked at the source and you can call pass in routes expanded by expand-routes
. Not sure what issue I ran into when I created that Github issue ages ago but I do still think you should let Pedestal’s internals expand routes for you unless you are explicitly not leveraging the defaults provided by io.pedestal.http/default-interceptors
.
i’m still poking around the interceptor stuff, checking out content negotiation and coersion etc.. the whole thing looks like a great paradigm
Interceptors are great. The core set of interceptors provided by Pedestal is intentionally kept small. Application-specific needs can be implemented as interceptors pretty easily.
the create-server fails with `Execution error (IllegalArgumentException) at io.pedestal.http.route/eval13846$fn$G (route.clj:426). No implementation of method: :router-spec of protocol: #’io.pedestal.http.route/RouterSpecification found for class: nil`. not really sure what this means without digging into src, but so far just following the tutorial / docs has gotten me to here 😕