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

31 lines
462 B
Go
Raw Normal View History

2020-12-26 15:17:20 +00:00
package main
import (
"context"
"github.com/asim/go-micro/v3"
2020-12-26 15:17:20 +00:00
)
type Greeter struct{}
func (g *Greeter) Hello(ctx context.Context, name *string, msg *string) error {
*msg = "Hello " + *name
return nil
}
func main() {
// create new service
service := micro.NewService(
micro.Name("greeter"),
)
// initialise command line
service.Init()
// set the handler
micro.RegisterHandler(service.Server(), new(Greeter))
// run service
service.Run()
}