1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-11-23 21:44:41 +02:00

Experimental top level init

This commit is contained in:
Asim
2015-12-20 23:50:16 +00:00
parent b9898ef45f
commit 2c983ef021
4 changed files with 202 additions and 0 deletions

47
go-micro.go Normal file
View File

@@ -0,0 +1,47 @@
/*
Go micro provides a pluggable library to build microservices.
import (
micro "github.com/micro/go-micro"
)
service := micro.New(
micro.Registry(r),
micro.Broker(b),
)
h := service.Server().NewHandler(&Greeter{})
service.Server().Handle(h)
service.Run()
req := service.Client.NewRequest(service, method, request)
rsp := response{}
err := service.Client.Call(req, rsp)
*/
package gomicro
import (
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/server"
)
type Service interface {
Client() client.Client
Server() server.Server
Run() error
String() string
}
type Option func(*Options)
var (
HeaderPrefix = "X-Micro-"
DefaultService = newService()
)
func NewService(opts ...Option) Service {
return newService(opts...)
}