add AllowDomain option for ghttp.CORS; add IsSubDomain function for gstr; improve grand.Intn

This commit is contained in:
John
2019-09-23 19:25:03 +08:00
parent 3218c89f17
commit 51d9fe5253
13 changed files with 66 additions and 43 deletions

View File

@ -7,7 +7,7 @@ import (
func main() {
s := g.Server()
s.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_FULLNAME)
s.SetNameToUriType(ghttp.URI_TYPE_FULLNAME)
s.EnableAdmin()
s.BindHandler("/", func(r *ghttp.Request) {
r.Response.Write("hello world")

View File

@ -17,10 +17,10 @@ func main() {
s3 := g.Server(3)
s4 := g.Server(4)
s1.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_DEFAULT)
s2.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_FULLNAME)
s3.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_ALLLOWER)
s4.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_CAMEL)
s1.SetNameToUriType(ghttp.URI_TYPE_DEFAULT)
s2.SetNameToUriType(ghttp.URI_TYPE_FULLNAME)
s3.SetNameToUriType(ghttp.URI_TYPE_ALLLOWER)
s4.SetNameToUriType(ghttp.URI_TYPE_CAMEL)
s1.BindObject("/{.struct}/{.method}", new(User))
s2.BindObject("/{.struct}/{.method}", new(User))

View File

@ -9,7 +9,7 @@ import (
func main() {
s := g.Server()
s.SetServerRoot("public")
s.SetNameToUriType(ghttp.NAME_TO_URI_TYPE_ALLLOWER)
s.SetNameToUriType(ghttp.URI_TYPE_ALLLOWER)
s.SetErrorLogEnabled(true)
s.SetAccessLogEnabled(true)
s.SetPort(2333)