ID service (#143)

* Add examples for DB

* add the id service

Co-authored-by: Janos Dobronszki <dobronszki@gmail.com>
This commit is contained in:
Asim Aslam
2021-06-08 12:18:42 +01:00
committed by GitHub
parent 82f0819aa7
commit 7a33de64cc
13 changed files with 497 additions and 0 deletions

31
id/main.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"math/rand"
"time"
"github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/services/id/handler"
pb "github.com/micro/services/id/proto"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
func main() {
// Create service
srv := service.New(
service.Name("id"),
service.Version("latest"),
)
// Register handler
pb.RegisterIdHandler(srv.Server(), handler.New())
// Run service
if err := srv.Run(); err != nil {
logger.Fatal(err)
}
}