mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-22 07:15:25 +00:00
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:
27
avatar/main.go
Normal file
27
avatar/main.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user