github.com/gogf/gf@v1.16.9/.example/net/ghttp/server/template/tpl1/tpl1.go (about) 1 package main 2 3 import ( 4 "github.com/gogf/gf/frame/g" 5 "github.com/gogf/gf/net/ghttp" 6 ) 7 8 func main() { 9 s := ghttp.GetServer() 10 s.BindHandler("/", func(r *ghttp.Request) { 11 r.Response.WriteTpl("index.tpl", g.Map{ 12 "title": "Test", 13 "name": "John", 14 "score": 100, 15 }) 16 }) 17 s.SetPort(8199) 18 s.Run() 19 }