Get request Json map[string]interface{}{} – Gin Gonic Golang Web Framwork 3
Get request Json map[string]interface{}{} – Gin Gonic Golang Web Framwork 3
Source Code
[sourcecode lang=”go” autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” highlight=”1-3,6,9″ htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false” title=”Source Code main.go”] // Get Request sending – map[string]interface{}{}package main
import "github.com/gin-gonic/gin"
func main() {
// create new router/server
r := gin.Default()
// get request method
// first value for path/url
// 2nd for function/callback
r.GET("/", func(c *gin.Context) {
// send json data via JSON()
// first value is status Code , 2nd is our data
c.JSON(200, map[string]interface{}{
"Hero": "here is hero",
"geo": "Here is geo",
"third value": "You can send anything",
})
})
r.Run() // Port 8080
}
[/sourcecode]
golang gingonic framework videos tutorials series
TAGS#
gin gonic tutorial
gin-gonic / examples
gin-gonic documentation
gin framework tutorial
gin web framework
gin router
golang gin context
gin router group
###Buy Me a Coffee https://www.buymeacoffee.com/khan1