Files
services/blog/main.go
Asim Aslam 854ac83563 go fmt
2021-01-27 11:42:00 +00:00

32 lines
733 B
Go

package main
import (
"github.com/micro/services/blog/handler"
proto "github.com/micro/services/blog/proto"
comments "github.com/micro/services/comments/proto"
posts "github.com/micro/services/posts/proto"
tags "github.com/micro/services/tags/proto"
"github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger"
)
func main() {
// Create service
srv := service.New(
service.Name("blog"),
)
// Register handler
proto.RegisterBlogHandler(srv.Server(), handler.NewBlog(
posts.NewPostsService("posts", srv.Client()),
comments.NewCommentsService("comments", srv.Client()),
tags.NewTagsService("tags", srv.Client()),
))
// Run service
if err := srv.Run(); err != nil {
logger.Fatal(err)
}
}