mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
20 lines
406 B
Go
20 lines
406 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/contrib/registry/etcd/v2"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/gogf/gf/v2/net/gsvc"
|
|
)
|
|
|
|
func main() {
|
|
gsvc.SetRegistry(etcd.New(`127.0.0.1:2379`))
|
|
|
|
s := g.Server(`hello.svc`)
|
|
s.BindHandler("/", func(r *ghttp.Request) {
|
|
g.Log().Info(r.Context(), `request received`)
|
|
r.Response.Write(`Hello world`)
|
|
})
|
|
s.Run()
|
|
}
|