Files
services/avatar/main.go
zhaoyang bba608b405 Pr/avatar (#319)
* feat: add avatar api
close #310

* chore: add description line

* fix: typo

* chore: reformat the json string to make it more readable and fix few bad indents

* fix: minimum go version

* feat: upload to Micro's CDN

* chore: delete redundant blank line

* chore: update README.md
2021-12-11 08:20:48 +00:00

28 lines
578 B
Go

package main
import (
"github.com/micro/services/avatar/handler"
pb "github.com/micro/services/avatar/proto"
imagePb "github.com/micro/services/image/proto"
"github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger"
)
func main() {
// Create service
srv := service.New(
service.Name("avatar"),
service.Version("latest"),
)
// Register handler
hdlr := handler.NewAvatar(imagePb.NewImageService("image", srv.Client()))
pb.RegisterAvatarHandler(srv.Server(), hdlr)
// Run service
if err := srv.Run(); err != nil {
logger.Fatal(err)
}
}