summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.go b/main.go
index ab3f1ca..385d8cc 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,7 @@ func main() {
e := echo.New()
e.GET("/hello", Greetings)
e.GET("/hello/:name", GreetingsWithParams)
+ e.GET("/hello-queries", GreetingsWithQuery)
e.Logger.Fatal(e.Start(":3000"))
}
@@ -33,3 +34,12 @@ func GreetingsWithParams(c echo.Context) error {
Message: "Hello World, my name is " + params,
})
}
+
+//http://localhost:3000/hello-queries?name=Saumit
+//{"message":"Hello World, I'm using queries and my name is Saumit"}
+func GreetingsWithQuery(c echo.Context) error {
+ query := c.QueryParam("name")
+ return c.JSON(http.StatusOK, HelloWorld{
+ Message: "Hello World, I'm using queries and my name is " + query,
+ })
+}