1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-29 18:04:17 +02:00

28 lines
431 B
Go
Raw Normal View History

2020-12-26 15:17:20 +00:00
package main
import (
"context"
2021-01-20 21:28:48 +00:00
proto "github.com/asim/go-micro/examples/v3/function/proto"
"github.com/asim/go-micro/v3"
2020-12-26 15:17:20 +00:00
)
type Greeter struct{}
func (g *Greeter) Hello(ctx context.Context, req *proto.HelloRequest, rsp *proto.HelloResponse) error {
rsp.Greeting = "Hello " + req.Name
return nil
}
func main() {
fnc := micro.NewFunction(
micro.Name("greeter"),
)
fnc.Init()
fnc.Handle(new(Greeter))
fnc.Run()
}