api

package
v0.20.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

Decode decodes endpoint metadata into an endpoint

func Encode

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

Encode encodes an endpoint to endpoint metadata

func Validate

func Validate(e *apipb.Endpoint) error

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

func WithEndpoint

func WithEndpoint(e *apipb.Endpoint) server.HandlerOption

WithEndpoint returns a server.HandlerOption with endpoint metadata set

Usage:

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

Types

type Api

type Api interface {
	// Init initialise options
	Init(...Option) error
	// Options Get the options
	Options() Options
	// Register a http handler
	Register(*apipb.Endpoint) error
	// Deregister unregister a route
	Deregister(*apipb.Endpoint) error
	// String implementation of api
	String() string
}

type Option

type Option func(*Options) error

type Options

type Options struct{}

Directories

Path Synopsis
Package handler provides http handlers
Package handler provides http handlers
api
Package api provides an http-rpc handler which provides the entire http request over rpc
Package api provides an http-rpc handler which provides the entire http request over rpc
event
Package event provides a handler which publishes an event
Package event provides a handler which publishes an event
http
Package http is a http reverse proxy handler
Package http is a http reverse proxy handler
rpc
Package rpc is a vine rpc handler.
Package rpc is a vine rpc handler.
web
Package web contains the web handler including websocket support
Package web contains the web handler including websocket support
Package resolver resolves a http request to an endpoint
Package resolver resolves a http request to an endpoint
grpc
Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service
Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service
host
Package host resolves using http host
Package host resolves using http host
path
Package path resolves using http path
Package path resolves using http path
vpath
Package vpath resolves using http path and recognised versioned urls
Package vpath resolves using http path and recognised versioned urls
Package router provides api service routing
Package router provides api service routing
registry
Package registry provides a dynamic api service router
Package registry provides a dynamic api service router
Package server provides an API gateway server which handles inbound requests
Package server provides an API gateway server which handles inbound requests
http
Package http provides a http server with features; acme, cors, etc
Package http provides a http server with features; acme, cors, etc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL