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 2 years ago • 2 comments
trafficstars

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

why not use different handlers?

kevwan avatar Jun 13 '23 00:06 kevwan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 13 '24 01:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Sep 13 '24 02:09 github-actions[bot]