http

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName string = "http-server"
)

Variables

View Source
var ErrUnknownComponent = fmt.Errorf("component is not the %s component", ComponentName)
View Source
var (
	ErrUnknownMethod error = fmt.Errorf("unknown http method")
)

Functions

func WithRequestLogger

func WithRequestLogger() components.Option

func WithRoute

func WithRoute(route Route) components.Option

func WithServerPort

func WithServerPort(port int) components.Option

Types

type Component

type Component struct {
	components.Base
	// contains filtered or unexported fields
}

func New

func New() *Component

func (*Component) Configure

func (c *Component) Configure(opts ...components.Option) error

func (*Component) RegisterRoute

func (c *Component) RegisterRoute(route Route) error

func (*Component) RegisterRoutes

func (c *Component) RegisterRoutes(routes ...Route) error

func (*Component) Router

func (c *Component) Router() *gin.Engine

func (*Component) Shutdown

func (c *Component) Shutdown() error

func (*Component) Start

func (c *Component) Start() error

type Route

type Route struct {
	Group      string
	Handler    gin.HandlerFunc
	URI        string
	HTTPMethod string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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