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#

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