http

package
v0.0.0-...-48fc2b8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoRouter

type EchoRouter struct {
	// contains filtered or unexported fields
}

func (*EchoRouter) AddRoute

func (r *EchoRouter) AddRoute(method RouteMethod, path string, handler http.Handler)

func (*EchoRouter) Handler

func (r *EchoRouter) Handler() http.Handler

func (*EchoRouter) ListenAndServe

func (r *EchoRouter) ListenAndServe(address string) error

type EchoRouterConfig

type EchoRouterConfig struct {
	ServiceName         string
	SkipHealthEndpoint  bool
	SkipMetricsEndpoint bool

	// Used to configure prometheus middleware
	MetricsNamespace string
	MetricsSubsystem string
}

type RouteMethod

type RouteMethod string
const (
	GET     RouteMethod = "GET"
	POST    RouteMethod = "POST"
	PUT     RouteMethod = "PUT"
	DELETE  RouteMethod = "DELETE"
	OPTIONS RouteMethod = "OPTIONS"
	ANY     RouteMethod = "ANY"

	HealthPath  = "/health"
	MetricsPath = "/metrics"
)

type Router

type Router interface {
	AddRoute(method RouteMethod, path string, handler http.Handler)
	Handler() http.Handler
	ListenAndServe(address string) error
}

func NewEchoRouter

func NewEchoRouter(config EchoRouterConfig) (Router, error)

Jump to

Keyboard shortcuts

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