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

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

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: