mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
33 lines
734 B
Go
33 lines
734 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/g"
|
|
"github.com/gogf/gf/g/net/ghttp"
|
|
"github.com/gogf/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()
|
|
}
|