Commit 274fd0d8 by mushishixian
parents 76e3e343 619a1f25
......@@ -6,3 +6,5 @@ gowatch.yml
*.exe~
cmd.exe~
/cmd/logs/
/cmd/*.exe~
/cmd/logs
File mode changed
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run ../cmd/search_http_server.go -config=../conf/config.ini
\ No newline at end of file
The file could not be displayed because it is too large.
......@@ -3,6 +3,7 @@ package main
import (
"flag"
"github.com/gin-gonic/gin"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/micro/go-micro/v2/web"
"log"
"search_server/boot"
......@@ -23,6 +24,21 @@ func main() {
r := gin.New()
gin_.BootStrap(r)
c:=grpc.NewClient()
r:=gin.New()
r.Handle("GET","/test", func(ctx *gin.Context) {
news
c:=Course.NewCourseService("api.jtthink.com.course",c)
course_rsp,_:=c.ListForTop(context.Background(),&Course.ListRequest{Size:10})
ctx.JSON(200,gin.H{"Result":course_rsp.Result})
})
service:=web.NewService(
web.Name("api.jtthink.com.http.course"),
web.Handler(r),
)
port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment