Fork me on GitHub
#reitit
<
2021-05-21
>
MikeE16:05:33

Hi all - new to reitit and curious about route conflicts. I have a very standard REST API with two routes:

GET /api/communities
POST /api/communities 

MikeE16:05:48

Reitit is reporting that this is a conflict. Do the HTTP verbs not uniquely identify the routes?

MikeE16:05:09

Being new to this though maybe I just donโ€™t have my route data structures setup correctly.. this is what I have

["/api"
   ["/communities"
    {:get {:summary    "Get list of communities"
           :parameters {}
           :response   {200
                        {:body communities-api-shape}}
           :handler    handler/communities-handler}}]
   ["/communities"
    {:post {:summary    "Create a new community"
           :parameters {:body communities-api-shape}
           :response   {200
                        {:body string?}}
           :handler    handler/create-community-handler}}]

dharrigan16:05:58

you normally just put it under one route, have a look here:

dharrigan16:05:43

notice how get and post (and delete and patch) are all nested under the route

dharrigan16:05:24

Maybe that might help ๐Ÿ™‚

MikeE16:05:02

ah! thank you!

dharrigan16:05:47

you're most welcome ๐Ÿ™‚

MikeE16:05:02

that fixed it ๐Ÿ™‚