mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 14:35:07 +00:00
add comments api
This commit is contained in:
30
comments/main.go
Normal file
30
comments/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/micro/micro/v3/service"
|
||||
log "github.com/micro/micro/v3/service/logger"
|
||||
"github.com/micro/services/comments/handler"
|
||||
pb "github.com/micro/services/comments/proto"
|
||||
admin "github.com/micro/services/pkg/service/proto"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// New Service
|
||||
srv := service.New(
|
||||
service.Name("comments"),
|
||||
service.Version("latest"),
|
||||
)
|
||||
|
||||
// Initialise service
|
||||
srv.Init()
|
||||
|
||||
h := handler.New(srv.Client())
|
||||
// Register Handler
|
||||
pb.RegisterCommentsHandler(srv.Server(), h)
|
||||
admin.RegisterAdminHandler(srv.Server(), h)
|
||||
|
||||
// Run service
|
||||
if err := srv.Run(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user