go-micro: github.com/micro/go-micro/api Index | Files | Directories

package api

import "github.com/micro/go-micro/api"


Package Files


func Encode Uses

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

Encode encodes an endpoint to endpoint metadata

func Validate Uses

func Validate(e *Endpoint) error

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

func WithEndpoint Uses

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 Endpoint Uses

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 example.com
    Host []string
    // HTTP Methods e.g GET, POST
    Method []string
    // HTTP Path e.g /greeter. Expect POSIX regex
    Path []string

Endpoint is a mapping between an RPC method and HTTP endpoint

func Decode Uses

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

Decode decodes endpoint metadata into an endpoint

type Service Uses

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


handlerPackage handler provides http handlers
handler/apiPackage api provides an http-rpc handler which provides the entire http request over rpc
handler/brokerPackage broker provides a go-micro/broker handler
handler/cloudeventsPackage cloudevents provides a cloudevents handler publishing the event using the go-micro/client
handler/eventPackage event provides a handler which publishes an event
handler/filePackage file serves file relative to the current directory
handler/httpPackage http is a http reverse proxy handler
handler/registryPackage registry is a go-micro/registry handler
handler/rpcPackage rpc is a go-micro rpc handler.
handler/udpPackage udp reads and write from a udp connection
handler/unixPackage unix reads from a unix socket expecting it to be in /tmp/path
handler/webPackage web contains the web handler including websocket support
resolverPackage resolver resolves a http request to an endpoint
resolver/grpcPackage grpc resolves a grpc service like /greeter.Say/Hello to greeter service
resolver/hostPackage host resolves using http host
resolver/microPackage micro provides a micro rpc resolver which prefixes a namespace
resolver/pathPackage path resolves using http path
resolver/vpathPackage vpath resolves using http path and recognised versioned urls
routerPackage router provides api service routing
router/registryPackage registry provides a dynamic api service router
serverPackage server provides an API gateway server which handles inbound requests
server/acmePackage acme abstracts away various ACME libraries
server/acme/autocertPackage autocert is the ACME provider from golang.org/x/crypto/acme/autocert This provider does not take any config.
server/acme/certmagicPackage certmagic is the ACME provider from github.com/mholt/certmagic
server/httpPackage http provides a http server with features; acme, cors, etc

Package api imports 5 packages (graph) and is imported by 39 packages. Updated 2020-02-22. Refresh now. Tools for package owners.