Files
gf/geg/net/ghttp/server/reload/simple.go
2019-04-03 00:03:46 +08:00

27 lines
523 B
Go

package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/net/ghttp"
"github.com/gogf/gf/g/os/gproc"
"time"
)
func main() {
s := g.Server()
s.BindHandler("/", func(r *ghttp.Request) {
r.Response.Writeln("哈喽!")
})
s.BindHandler("/pid", func(r *ghttp.Request) {
r.Response.Writeln(gproc.Pid())
})
s.BindHandler("/sleep", func(r *ghttp.Request) {
r.Response.Writeln(gproc.Pid())
time.Sleep(10 * time.Second)
r.Response.Writeln(gproc.Pid())
})
s.EnableAdmin()
s.SetPort(8199)
s.Run()
}