Get request Json array 4 – GinGonic Golang Web Framwork

 

Get request Json array 4 – GinGonic Golang Web Framwork

Source Code

 

// Get Request -- Array/ slice data
package main
import "github.com/gin-gonic/gin"
func main() {
  // create router/server
  r := gin.Default()
  // get request
  // mention path and callback function
  r.GET("/", func(c *gin.Context) {
    // 200 is status code here
    // data is slice/array form
    c.JSON(200, []string{
      "firstname", "2nd person name",
      "3rd value", "so on..."})
  })
  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: