Optional Params in GET request

12 Views Asked by At

I'm trying to perform a GET request on an endpoint and I'd like to set it up so that both options are possible: /logs/container-logs/:id => ok, /logs/:id => ok. So roughly something like this:

GET("/logs/{container}?/:id", {
   if (!container) // /logs/:id
   else if (container == "service1") // /logs/service1/:id
})
0

There are 0 best solutions below