I'm not sure what the best way is. But I think you can refer to the existing solutions. For example gin, mux.
Link: https://github.com/gin-gonic/gin/blob/master/tree.go#L116 在2023年10月19日星期四 UTC+8 19:27:59<Dejan Duh> 写道: > Hi everyone. I'm building an api with net/http and I'm having trouble > with url variables. How can I get the url variables form the url in the > REST way. Example, if I have a url like "http:/localhost:3000/users/:id". > I want to get the user with the id given from the url. What is the best > way to get the id using only the standart lib? Thanks > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/267f0cbf-6b52-454b-a941-966db3465078n%40googlegroups.com.