1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| package main import ( "github.com/gin-gonic/gin" )
type User struct{ Uaername string `uri:"username"` Password string `uri:"password"` } func login(c *gin.Context){ var user User c.ShouldBindUri(&user) c.String(200, "User:%s", user) }
func main(){ e := gin.Default() e.GET("/login/:username/:password", login) e.Run() }
|