remove internal logging for gsession.StorageFile; improve example codes for CORS feature of ghttp.Server

This commit is contained in:
John
2020-02-16 23:00:42 +08:00
parent 20b64507b1
commit 89f869dd44
4 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/os/glog"
)
func MiddlewareCORS(r *ghttp.Request) {
@ -11,6 +12,7 @@ func MiddlewareCORS(r *ghttp.Request) {
}
func Order(r *ghttp.Request) {
glog.Println("order")
r.Response.Write("GET")
}
@ -18,7 +20,7 @@ func main() {
s := g.Server()
s.Group("/api.v1", func(group *ghttp.RouterGroup) {
group.Middleware(MiddlewareCORS)
g.GET("/order", Order)
group.GET("/order", Order)
})
s.SetPort(8199)
s.Run()

View File

@ -20,7 +20,7 @@ func main() {
s := g.Server()
s.Group("/api.v1", func(group *ghttp.RouterGroup) {
group.Middleware(MiddlewareCORS)
g.GET("/order", Order)
group.GET("/order", Order)
})
s.SetPort(8199)
s.Run()

View File

@ -26,7 +26,7 @@ func main() {
s := g.Server()
s.Group("/api.v1", func(group *ghttp.RouterGroup) {
group.Middleware(MiddlewareCORS)
g.GET("/order", Order)
group.GET("/order", Order)
})
s.SetPort(8199)
s.Run()

View File

@ -73,7 +73,7 @@ func NewStorageFile(path ...string) *StorageFile {
}
// Batch updates the TTL for session ids timely.
gtimer.AddSingleton(DefaultStorageFileLoopInterval, func() {
intlog.Print("StorageFile.timer start")
//intlog.Print("StorageFile.timer start")
var id string
var err error
for {
@ -84,7 +84,7 @@ func NewStorageFile(path ...string) *StorageFile {
intlog.Error(err)
}
}
intlog.Print("StorageFile.timer end")
//intlog.Print("StorageFile.timer end")
})
return s
}