mirror of
https://gitee.com/johng/gf
synced 2026-07-04 13:02:36 +08:00
28 lines
526 B
Go
28 lines
526 B
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/net/ghttp"
|
|
"github.com/gogf/gf/os/gproc"
|
|
)
|
|
|
|
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()
|
|
}
|