web icon indicating copy to clipboard operation
web copied to clipboard

Cast string arguments in request path to match handler types

Open hoisie opened this issue 15 years ago • 2 comments

For instance, the route "/([0-9]+), should be able to be passed to the following handler:

func handler ( n int ) string { ... }

hoisie avatar Dec 16 '09 06:12 hoisie

I would really like to see something like this

For example in pseudo: /edit/:userId -> func editUser(userId int) in type safe manner

dahankzter avatar Apr 27 '11 17:04 dahankzter

Is this possible?! I'd be very interested in knowing how one would go about this. Pass the handler as interface{} and use reflect?

kivikakk avatar Apr 28 '11 10:04 kivikakk