2

Get Request JSON map[string]string{} 2 – Gin Gonic Golang Web Framework

Get Request JSON map[string]string{} 2 – Gin Gonic Golang Web Framework

 

Source Code

 
// In this tutorial we will send json data
package main
import "github.com/gin-gonic/gin"
func main() {
    // create router/server
    r := gin.Default()
    // Get request
    // 2 args = one is path/url , 2nd is callback
    r.GET("/", func(c *gin.Context) {
        // 2 args = one is statusCode, 2nd is data
        c.JSON(200,
            map[string]string{"Key": "Here is my value"})
    })
    r.Run() // lets run the server 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 2 comments
Zhijiun - a few months ago

Can you make a video about how gin connects to static content like css or js?

Reply
    Tony BB - last month

    Yes. I will create a video about it.

    Reply

Leave a Reply: