1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-23 17:53:05 +02:00

25 lines
450 B
Go
Raw Normal View History

2020-12-26 15:17:20 +00:00
package main
import (
"context"
"fmt"
"github.com/asim/go-micro/v3"
"github.com/asim/go-micro/v3/client"
2020-12-26 15:17:20 +00:00
)
func main() {
service := micro.NewService()
service.Init()
c := service.Client()
request := c.NewRequest("greeter", "Greeter.Hello", "john", client.WithContentType("application/json"))
var response string
if err := c.Call(context.TODO(), request, &response); err != nil {
fmt.Println(err)
return
}
fmt.Println(response)
}