hello.go
package main
import (
"github.com/gin-gonic/gin"
)
func User(ctx *gin.Context) {
ctx.HTML(200,"user.html",nil)
}
func main() {
router := gin.Default()
router.LoadHTMLGlob("template/**/*")
router.GET("/user",User)
router.Run(":8082")
}
user.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>User</title>
</head>
<body>
<h1>User</h1>
</body>
</html>