Replies: 1 comment
-
|
$(cat <<'ENDOFBODY'
e.URI(getUser, "42") // looks up the route registered with getUser handler
e.GET("/users/:id", getUser).Name = "get-user"
e.Reverse("get-user", "42") // → "/users/42"Use // register with a name
usersRoute := e.GET("/users/:id", getUser)
usersRoute.Name = "get-user"
// generate URLs anywhere
url := e.Reverse("get-user", userId)Short version: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm not sure if this is expected behavior or I'm using it wrong, but when I set the name for a route (
e.GET("", myHandler).Name = "MyName") I'm not able to usee.URI(myHandler)anymore and have to usee.Reverse("MyName")instead. I was expecting URI to continue working, can't see why one should affect the other.Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions