mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 20:28:17 +08:00
增加docker测试脚本
This commit is contained in:
parent
8b0054891b
commit
c51d9b9359
15
geg/other/docker/test/http.go
Normal file
15
geg/other/docker/test/http.go
Normal 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()
|
||||
}
|
27
geg/other/docker/test/redis.go
Normal file
27
geg/other/docker/test/redis.go
Normal 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()
|
||||
}
|
Loading…
Reference in New Issue
Block a user