同福

Gin框架使用网页模板的方法

设置网页模板

建立模板目录

./templates

创建首页模板文件

./templates/index.html

调用网页模板

g := gin.Default()
g.LoadHTMLGlob("./templates/*")
g.GET("/", func(c *Context){
    c.HTML(200, "index.html", H{})
})
g.Run()