github.com/gogf/gf@v1.16.9/.example/net/ghttp/server/duplicate/duplicate3.go (about)

     1  // 路由重复注册检查 - object
     2  package main
     3  
     4  import (
     5  	"github.com/gogf/gf/frame/g"
     6  	"github.com/gogf/gf/net/ghttp"
     7  )
     8  
     9  type Object struct{}
    10  
    11  func (o *Object) Index(r *ghttp.Request) {
    12  	r.Response.Write("object index")
    13  }
    14  
    15  func (o *Object) Show(r *ghttp.Request) {
    16  	r.Response.Write("object show")
    17  }
    18  
    19  func main() {
    20  	s := g.Server()
    21  	g.Server().BindObject("/object", new(Object))
    22  	g.Server().BindObject("/object", new(Object))
    23  	s.SetPort(8199)
    24  	s.Run()
    25  }