mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
* Add examples for DB * add the id service Co-authored-by: Janos Dobronszki <dobronszki@gmail.com>
32 lines
519 B
Go
32 lines
519 B
Go
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)
|
|
}
|
|
}
|