go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

how i can using 1 handler for two path /user and user/:id

Open handestd opened this issue 1 year ago • 2 comments

i wanna handle /user & user/:id by one handler if parameter :id is empty

image

i try to define struct like this: Id string path:"id,optional"

but, when i access get /user then i get '404 not found page'

handestd avatar Jun 09 '23 09:06 handestd