Hi, i have a problem with routes and i can't find the solution
"/api" {:interceptors [http/transit-body] "/echo" {:get `api/echo} "/catalogues" {:get `[:catalogues api/get]} "/code-systems" {:get `[:code-systems api/get]} "/code-systems/formats" {:get `[:code-system-formats api/get]} "/code-systems/formats/:format" {:get `[:code-system-format api/get]} "/code-systems/:id" {:get `[:code-system-details api/get]} "/code-systems/:id/concepts" {:get `[:code-system-concepts api/get]} "/code-systems/:id/concepts/:id" {:get `[:code-system-concept-details api/get]}
Why does "/code-systems/formats/:format" {:get `[:code-system-format api/get]} return 404 ?
Reading from a phone, and lack of highlighting doesn’t help, but I don’t think you’re supposed to wrap :get [,,,]
in a map. I’m surprised you don’t get an error.
If you paste your entire routes definition it might be easier to catch.
Hi @orestis and thanks for your response. I am new to pedestal and i can't find a way to make these routes working
(def routes #{"/" {:get pages/home} "/health" {:get `api/health} "/app" {:interceptors [http/html-body] "" {:get `pages/spa}} "/api" {:interceptors [http/transit-body] "/echo" {:get `api/echo} "/catalogues" {:get `[:catalogues api/get]} "/code-systems" {:get `[:code-systems api/get]} "/code-systems/formats" {:get `[:code-system-formats api/get]} "/code-systems/formats/ATC" {:get `[:code-system-format api/get]} "/code-systems/:id" {:constraints {:id #"[0-9]+"} :get `[:code-system-details api/get]} ; "/code-systems/:id/concepts" {:get `[:code-system-concepts api/get]} ; "/code-systems/:id/concepts/:id" {:get `[:code-system-concept-details api/get]} "/user" {:get `api/user}}})
(def service {;; do not block thread that starts web server ::http/join? false ::http/port port ::http/host "0.0.0.0" ::http/resource-path "/public" ::http/routes (route/expand-routes routes) ::http/enable-session {:cookie-name "SID" :store (cookie/cookie-store)} ::http/type :jetty ;; for dev only? ::http/secure-headers {:content-security-policy-settings {:object-src "none"}} ::http/container-options {:h2c? true :h2? false :ssl? false}})
i did try to change to sopmething like this
(def routes [[["/" :get pages/home ["/app" {:get pages/spa} ^:interceptors [http/html-body]]]]])
but i have this error
there's a snippets feature in Slack if you click the paperclip, like this:
Caused by: java.lang.IllegalArgumentException: No implementation of method: :expand-verb-action of protocol: #'io.pedestal.http.route.definition.terse/ExpandableVerbAction found for class: app.html_pages$spa
Ok sorry
there you go 🙂
now it's expandable and has code highlighting.
thanks and sorry for that
no worries if you didn't know you didn't know. 🙂
Even with this new routes, last route does not work (api/code-systems/formats/test1) -> 404 not found
That is a weird route syntax. I’m only familiar with the table syntax...
http://pedestal.io/reference/routing-quick-reference - doesn’t seem to be a need to quote the vector as you do?
If i don't quote i haave error like Caused by: java.lang.IllegalArgumentException: No implementation of method: :expand-verb-action of protocol: #'io.pedestal.http.route.definition.terse/ExpandableVerbAction found for class: app.html_pages$spa
But i think i'll go with reitit ring. There is not so much documentation on pedestal and i am not able to understand via the api documentation. Many thanks @orestis
I won’t blame you — I’ve only used the table syntax because it’s the only one that made some sense. The syntax you’re using looks very fiddly to get right.