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

// 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
}

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

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: