mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
26 lines
513 B
Go
26 lines
513 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/net/ghttp"
|
|
"github.com/gogf/gf/os/gtime"
|
|
)
|
|
|
|
func main() {
|
|
s := g.Server()
|
|
s.Group("/", func(group *ghttp.RouterGroup) {
|
|
group.GET("/set", func(r *ghttp.Request) {
|
|
r.Session.Set("time", gtime.Timestamp())
|
|
r.Response.Write("ok")
|
|
})
|
|
group.GET("/get", func(r *ghttp.Request) {
|
|
r.Response.WriteJson(r.Session.Map())
|
|
})
|
|
group.GET("/clear", func(r *ghttp.Request) {
|
|
r.Session.Clear()
|
|
})
|
|
})
|
|
s.SetPort(8199)
|
|
s.Run()
|
|
}
|