This section is empty.


This section is empty.


func Encode

func Encode(e *Endpoint) map[string]string

Encode encodes an endpoint to endpoint metadata

func Validate

func Validate(e *Endpoint) error

Validate validates an endpoint to guarantee it won't blow up when being served

func WithEndpoint

func WithEndpoint(e *Endpoint) server.HandlerOption

WithEndpoint returns a server.HandlerOption with endpoint metadata set


proto.RegisterHandler(service.Server(), new(Handler), api.WithEndpoint(
		Name: "Greeter.Hello",
		Path: []string{"/greeter"},


type Api

type Api interface {
	// Initialise options
	Init(...Option) error
	// Get the options
	Options() Options
	// Register a http handler
	Register(*Endpoint) error
	// Register a route
	Deregister(*Endpoint) error
	// Implemenation of api
	String() string

type Endpoint

type Endpoint struct {
	// RPC Method e.g. Greeter.Hello
	Name string
	// Description e.g what's this endpoint for
	Description string
	// API Handler e.g rpc, proxy
	Handler string
	// HTTP Host e.g
	Host []string
	// HTTP Methods e.g GET, POST
	Method []string
	// HTTP Path e.g /greeter. Expect POSIX regex
	Path []string
	// Body destination
	// "*" or "" - top level message value
	// "string" - inner message value
	Body string
	// Stream flag
	Stream bool

Endpoint is a mapping between an RPC method and HTTP endpoint

func Decode

func Decode(e map[string]string) *Endpoint

Decode decodes endpoint metadata into an endpoint

type Option

type Option func(*Options) error

type Options

type Options struct{}

type Service

type Service struct {
	// Name of service
	Name string
	// The endpoint for this service
	Endpoint *Endpoint
	// Versions of this service
	Services []*registry.Service

Service represents an API service

Source Files


Path Synopsis
handler Package handler provides http handlers
handler/api Package api provides an http-rpc handler which provides the entire http request over rpc
handler/event Package event provides a handler which publishes an event
handler/http Package http is a http reverse proxy handler
handler/rpc Package rpc is a go-micro rpc handler.
handler/web Package web contains the web handler including websocket support
resolver Package resolver resolves a http request to an endpoint
resolver/grpc Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service
resolver/host Package host resolves using http host
resolver/path Package path resolves using http path
resolver/vpath Package vpath resolves using http path and recognised versioned urls
router Package router provides api service routing
router/registry Package registry provides a dynamic api service router
server Package server provides an API gateway server which handles inbound requests
server/acme Package acme abstracts away various ACME libraries
server/acme/autocert Package autocert is the ACME provider from This provider does not take any config.
server/acme/certmagic Package certmagic is the ACME provider from
server/http Package http provides a http server with features; acme, cors, etc