2018-08-12 12:22:02 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-07-29 21:01:19 +08:00
|
|
|
"github.com/gogf/gf/frame/g"
|
|
|
|
"github.com/gogf/gf/net/ghttp"
|
2018-08-12 12:22:02 +08:00
|
|
|
)
|
|
|
|
|
2019-04-03 00:03:46 +08:00
|
|
|
type User struct{}
|
2018-08-12 12:22:02 +08:00
|
|
|
|
|
|
|
func (u *User) ShowList(r *ghttp.Request) {
|
2019-04-03 00:03:46 +08:00
|
|
|
r.Response.Write("list")
|
2018-08-12 12:22:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2019-04-03 00:03:46 +08:00
|
|
|
s1 := g.Server(1)
|
|
|
|
s2 := g.Server(2)
|
|
|
|
s3 := g.Server(3)
|
|
|
|
s4 := g.Server(4)
|
|
|
|
|
|
|
|
s1.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_DEFAULT)
|
|
|
|
s2.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_FULLNAME)
|
|
|
|
s3.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_ALLLOWER)
|
|
|
|
s4.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_CAMEL)
|
|
|
|
|
|
|
|
s1.BindObject("/{.struct}/{.method}", new(User))
|
|
|
|
s2.BindObject("/{.struct}/{.method}", new(User))
|
|
|
|
s3.BindObject("/{.struct}/{.method}", new(User))
|
|
|
|
s4.BindObject("/{.struct}/{.method}", new(User))
|
|
|
|
|
|
|
|
s1.SetPort(8100)
|
|
|
|
s2.SetPort(8200)
|
|
|
|
s3.SetPort(8300)
|
|
|
|
s4.SetPort(8400)
|
|
|
|
|
|
|
|
s1.Start()
|
|
|
|
s2.Start()
|
|
|
|
s3.Start()
|
|
|
|
s4.Start()
|
|
|
|
|
|
|
|
g.Wait()
|
2018-08-12 12:22:02 +08:00
|
|
|
}
|