Get Request c.String() 1- GinGonic Golang Web Framwork

Here is Golang GinGonic Tutorial series

 

Get Request c.String() 1- GinGonic Golang Web Framwork

#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”] // lets initialize module
// lets install gin-gonic
// go get -u github.com/gin-gonic/gin
package main
// import gin-gonic
import "github.com/gin-gonic/gin"
func main() {
/// lets create default router/server
r := gin.Default()
// lets create our first get method
// it takes 2 args… path/ url and function
r.GET("/", func(c *gin.Context) {
// now lets send data
// first arg is status code , 200
// 2nd arg is the data we want
c.String(200, "Here is first server")
})
r.Run() // to run the server
// run project in console port is by default 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: