github.com/gogf/gf@v1.16.9/.example/net/ghttp/server/duplicate/duplicate1.go (about) 1 // 路由重复注册检查 - handler 2 package main 3 4 import ( 5 "github.com/gogf/gf/frame/g" 6 "github.com/gogf/gf/net/ghttp" 7 ) 8 9 func main() { 10 s := g.Server() 11 s.BindHandler("/", func(r *ghttp.Request) { 12 r.Response.Writeln("哈喽世界!") 13 }) 14 s.BindHandler("/", func(r *ghttp.Request) { 15 r.Response.Writeln("哈喽世界!") 16 }) 17 s.SetPort(8199) 18 s.Run() 19 }