Get request gin.H{} 5 – Gin Gonic Golang Web Framework

Get request gin.H{} 5 – Gin Gonic Golang Web Framework

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 — shortcut for map[string]interface{}
// gin.H{}
package main
import "github.com/gin-gonic/gin"
func main() {
// new router/server
r := gin.Default()
// get requestion function
// path is "/" and callback function
r.GET("/", func(c *gin.Context) {
// let use gin.H{} shortcut for map[string]interface{}
// 200 is status Code
//
c.JSON(200, gin.H{"firstName": "GINGer"})
})
r.Run() /// port:8080
}
[/sourcecode]

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: