pedestal

Vincent 2025-06-24T15:08:44.203309Z

Hi, I'm using pedestal for a new project. I have an endpoint /indicators/:id and another one /indicators/search but the search endpoint doesn't get hit because it gets inferred as an :id when using the #{set} syntax. What is the correct approach?

Vincent 2025-06-24T15:28:08.680099Z

(defn routes [db]
  #{;lookup by indicator id
    ["/indicators/:id" :get [(db-interceptor db) indicator-handler] :route-name :get-indicator]
    ;search uses :id since #{clojure set} doesn't guarantee matching order
    
    ["/indicators/:id" :post [(body-params/body-params) (db-interceptor db) indicator-handler] :route-name :post-indicator]
    ...
I would like the second line [POST] to read "/indicators/search" but if I do it that way I get Not Found instead of actual results. Which is confusing, I would think it would match according to HTTP Method and then the route name/wording. Anyway, I think this is because I'm using #{set} syntax?

Vincent 2025-06-24T16:13:30.076929Z

Apparently pedestal matches to Path first and then Method, is there an easy way to convert my routes to table or vector routing?

hlship 2025-06-24T16:57:26.856069Z

Which version of Pedestal are you using?

Vincent 2025-06-24T17:03:12.001959Z

[io.pedestal/pedestal.service "0.6.3"] [io.pedestal/pedestal.route "0.6.1"] [io.pedestal/pedestal.jetty "0.6.3"]

Vincent 2025-06-24T17:06:37.425649Z

should be on 7.2?

hlship 2025-06-24T17:06:40.109499Z

First off, the latest stable version of Pedestal is 0.7.2. Routing is a bit more complex than you might think, and has been worked on extensively in 0.8. I think there is more to this than the snippets you've shown, as routes with the same path are absolutely differentiated by method.

Vincent 2025-06-24T17:07:32.762799Z

If I make two separate paths /indicators/:id and /indicators/search the set assumes that search is an :id so I think I need to use the vector format?

hlship 2025-06-24T17:09:13.789819Z

When you have both ["/indicators/:id" :get ...] and ["/indicators/search" :get ...] that's a bit of a conflict and is handled in different ways in different versions of Pedestal. In 0.7.2, you would directly invoke the table/table-routes function, rather than use the set syntax, so that you can put the routes in a specific order, and use the linear router. In 0.8.0, you would do nothing because the default router, Sawtooth, handles this case correctly; it does not consider it a conflict.

Vincent 2025-06-24T17:11:35.334859Z

Hm that's cool, I will try 8.0-beta-1 then

hlship 2025-06-24T17:13:33.286809Z

It's quite stable for a beta. I don't see a lot of distance between where the code is now and the final release.

Vincent 2025-06-24T17:29:01.907799Z

Nice. I got it working with 8.0-beta-1 although I get a lot of deprecation warnings in the console for the code I'm using, but that's livable

👍 1
Vincent 2025-06-24T18:56:55.070029Z

Thanks!

hlship 2025-06-24T17:01:13.798959Z

Help Wanted Pedestal includes the embedded template for use with deps-new; it's in the documentation and it's quite handy. However, it includes a simple index.html file that is unstyled and ugly. I would like a very simple index.html and app.css that makes for a prettier page. Absolutely not anything elaborate, just something that will looks nice and say 'we put some effort into this" and include the Pedestal logo; something that echos the https://pedestal.io 's overall look. Again, I'm thinking something that will likely be thrown away, just a few lines of HTML and CSS. Any volunteers with basic HTML/CSS skills?

➕ 1
2025-06-30T10:30:42.196799Z

I got an error when signing the CLA (twice).. but I've opened a PR, so feel free to clone it, add it under your name and close my PR 👍

hlship 2025-06-30T14:47:23.713589Z

Thanks for the effort, I’ll look into why the CLA app is failing when I get to the office

2025-06-27T08:15:50.346369Z

What about this? I can adapt it to whatever you prefer and open a PR..

hlship 2025-06-29T20:19:45.594309Z

Have you signed the CLA? A PR where this is added to the embedded template would be quite welcome!

hlship 2025-06-28T23:33:24.724759Z

Looks nice