Serving static files 8 – Gin Gonic Golang Web Framework
Serving static files 8 – 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”] // working and serving static files e.g images/text/html etcpackage main
import "github.com/gin-gonic/gin"
func main() {
// create new router/server
r := gin.Default()
r.Static("/", "./")
// first arg/parameter is path/url and 2nd is the folder
// lets create a file name index.html
// 2nd one can be image etc or text file
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