mirror of
https://gitee.com/johng/gf
synced 2026-06-29 10:31:34 +08:00
example&comment update
This commit is contained in:
@ -16,10 +16,10 @@ func main() {
|
||||
})
|
||||
s.BindHookHandlerByMap(p, map[string]ghttp.HandlerFunc{
|
||||
ghttp.HookBeforeServe: func(r *ghttp.Request) {
|
||||
glog.To(r.Response.Writer).Print("BeforeServe")
|
||||
glog.To(r.Response.Writer).Print(r.Context(), "BeforeServe")
|
||||
},
|
||||
ghttp.HookAfterServe: func(r *ghttp.Request) {
|
||||
glog.To(r.Response.Writer).Print("AfterServe")
|
||||
glog.To(r.Response.Writer).Print(r.Context(), "AfterServe")
|
||||
},
|
||||
})
|
||||
s.SetPort(8199)
|
||||
|
||||
@ -10,7 +10,7 @@ func main() {
|
||||
s1 := ghttp.GetServer("s1")
|
||||
s1.SetPort(8882)
|
||||
s1.BindHandler("/", func(r *ghttp.Request) {
|
||||
glog.Print("s1")
|
||||
glog.Print(r.Context(), "s1")
|
||||
r.Response.Writeln("s1")
|
||||
})
|
||||
s1.Start()
|
||||
@ -18,7 +18,7 @@ func main() {
|
||||
s2 := ghttp.GetServer("s2")
|
||||
s2.SetPort(8882)
|
||||
s2.BindHandler("/", func(r *ghttp.Request) {
|
||||
glog.Print("s2")
|
||||
glog.Print(r.Context(), "s2")
|
||||
r.Response.Writeln("s2")
|
||||
})
|
||||
s2.Start()
|
||||
|
||||
Reference in New Issue
Block a user