mirror of
https://gitee.com/johng/gf
synced 2026-07-04 04:52:48 +08:00
32 lines
853 B
Go
32 lines
853 B
Go
package main
|
|
|
|
import (
|
|
"gitee.com/johng/gf/g"
|
|
"gitee.com/johng/gf/g/net/ghttp"
|
|
"gitee.com/johng/gf/g/os/glog"
|
|
)
|
|
|
|
func main() {
|
|
s := g.Server()
|
|
s.BindHandler("/priority/show", func(r *ghttp.Request) {
|
|
r.Response.Write("priority test")
|
|
})
|
|
|
|
s.BindHookHandlerByMap("/priority/:name", map[string]ghttp.HandlerFunc {
|
|
"BeforeServe" : func(r *ghttp.Request) {
|
|
glog.Println(r.Router.Uri)
|
|
},
|
|
})
|
|
s.BindHookHandlerByMap("/priority/*any", map[string]ghttp.HandlerFunc {
|
|
"BeforeServe" : func(r *ghttp.Request) {
|
|
glog.Println(r.Router.Uri)
|
|
},
|
|
})
|
|
s.BindHookHandlerByMap("/priority/show", map[string]ghttp.HandlerFunc {
|
|
"BeforeServe" : func(r *ghttp.Request) {
|
|
glog.Println(r.Router.Uri)
|
|
},
|
|
})
|
|
s.SetPort(8199)
|
|
s.Run()
|
|
} |