增加docker测试脚本

This commit is contained in:
John 2018-06-12 19:24:40 +08:00
parent 8b0054891b
commit c51d9b9359
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package main
import (
"gitee.com/johng/gf/g"
"gitee.com/johng/gf/g/net/ghttp"
)
func main() {
s := g.Server()
s.BindHandler("/", func(r *ghttp.Request){
r.Response.Writeln("哈喽世界!")
})
s.SetPort(8199)
s.Run()
}

View File

@ -0,0 +1,27 @@
package main
import (
"gitee.com/johng/gf/g"
"gitee.com/johng/gf/g/net/ghttp"
"gitee.com/johng/gf/g/database/gredis"
)
func main() {
s := g.Server()
s.BindHandler("/", func(r *ghttp.Request) {
redis := gredis.New(gredis.Config{
Host: "redis-service",
Port: 9999,
})
defer redis.Close()
v, err := redis.Do("GET", "k")
r.Response.Writeln(v)
r.Response.Writeln(err)
v, err = redis.Do("SET", "k", "v")
r.Response.Writeln(v)
r.Response.Writeln(err)
})
s.Run()
}