http

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogginOption added in v0.1.2

func WithLogginOption(option LoggingOption)

Types

type Config added in v0.0.7

type Config struct {
	Port                int      `yaml:"port" env:"HTTP_PORT" default:"8000"`
	AccessLog           bool     `yaml:"access_log" env:"HTTP_ACCESS_LOG" default:"false"`
	ErrorLogChannel     string   `yaml:"error_log_channel" default:"default"`
	AccessLogChannel    string   `yaml:"access_log_channel"`
	TrustedProxies      []string `yaml:"trusted_proxies"`
	TrustedProxyHeaders []string `yaml:"trusted_proxy_headers"`
	EnableCors          bool     `yaml:"enable_cors" env:"HTTP_ENABLE_CORS" default:"false"`
}

type HttpBoundle added in v0.0.7

type HttpBoundle interface {
	//Lifetime container callback
	// usually register request lifetime instance to IoC-Container (per-request unique)
	// this function will run before every request handling
	Lifetime(ioc container.Interface, request contracts.RequestContract)
}

type LoggingOption added in v0.1.2

type LoggingOption func(request contracts.RequestContract, statusCode int, startAt time.Time) zap.Field

type RoutesRegister added in v0.0.7

type RoutesRegister interface {
	RegisterRoutes(rw *router.Wrapper)
}

type Server added in v0.0.7

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

func NewServer added in v0.0.7

func NewServer(k *h.Kernel) *Server

func (*Server) GetFastHttpServer added in v0.0.7

func (s *Server) GetFastHttpServer(kernel *h.Kernel) *fasthttp.Server

func (*Server) Serve added in v0.0.7

func (s *Server) Serve(addr string, register h.RouterRegister, done chan struct{})

type Service

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

func NewService added in v0.0.7

func NewService() *Service

func (*Service) Register

func (s *Service) Register(app *framework.App) error

Register service when app starting, before http server start you can configure service, prepare global vars etc. running at main goroutine

func (*Service) WithRoutes added in v0.0.7

func (s *Service) WithRoutes(rg func(rw *router.Wrapper)) *Service

WithRoutes, with http routes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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