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
This commit is contained in:
zhaoyang
2021-12-11 16:20:48 +08:00
committed by GitHub
parent f68c1cb08a
commit bba608b405
16 changed files with 664 additions and 64 deletions

27
avatar/main.go Normal file
View File

@@ -0,0 +1,27 @@
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)
}
}