From 651305c0f5cd1ee9fd67b9629f15a323b7173b68 Mon Sep 17 00:00:00 2001 From: Robert Wilkinson Date: Fri, 6 Feb 2015 09:14:12 -0800 Subject: [PATCH] Update README.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index df1ed21..a28d985 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,25 @@ func main() { r.Run(":8080") } ``` +###Form parameters +```go +func main() { + r := gin.Default() + + // This will respond to urls like search?firstname=Jane&lastname=Doe + r.GET("/search", func(c *gin.Context) { + // You need to call ParseForm() on the request to receive url and form params first + c.Request.ParseForm() + + firstname := c.Request.Form.Get("firstname") + lastname := c.Request.Form.get("lastname") + message := "Hello "+ firstname + lastname + c.String(200, message) + }) + r.Run(":8080") +} +``` #### Grouping routes ```go