Serving static files 8 – Gin Gonic Golang Web Framework

Serving static files 8 – Gin Gonic Golang Web Framework

Source Code

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