From 3feb5578dd8c9e3d6e04211d78df541ffd50440c Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 25 May 2015 21:15:52 -0700 Subject: [PATCH] add querystring parameter example to readme --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index c8fe60e3..1ae003e8 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,24 @@ func main() { r.Run(":8080") } ``` + +#### Querystring parameters +```go +func main() { + r := gin.Default() + + // Query string parameters are parsed used the existing underlying request object. + // The request responds to a url matching: /search?firstname=Jane&lastname=Doe + r.GET("/search", func(c *gin.Context) { + firstname := c.Request.URL.Query().Get("latitude") + lastname := c.Request.URL.Quert().Get("longitude") + message := "Hello " + firstname + lastname + c.String(http.StatusOK, message) + }) + r.Run(":8080") +} +``` + ###Form parameters ```go func main() {