Post Request 7 – Gin Gonic Golang Web Framework
Post Request 7 – 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”]// we are going to learn POST Request
package main
import "github.com/gin-gonic/gin"
func main() {
// new router/server
r := gin.Default()
//r.LoadHTMLGlob("./templates/*")
r.Static("/", "./")
// Post request is like GET . first parameter is path .. 2nd is function
r.POST("/post", func(c *gin.Context) {
//user := c.DefaultPostForm("user", "unknown")
// first parameter is the form field name and 2nd is default
//c.String(200, "hello %s", user)
//c.HTML(200, "index.tmpl", user)
// 200 is statusCode and %s is to display string
})
r.Run()
}
[/sourcecode]
golang gingonic framework videos tutorials series
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