mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-12 08:23:58 +02:00
d94936f6c9
* v3 * revert plugins * fixup some issues
31 lines
462 B
Go
31 lines
462 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/asim/go-micro/v3"
|
|
)
|
|
|
|
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()
|
|
}
|