http

package
v0.0.0-...-ed918b1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIdList

func GetIdList(r *http.Request) []string

Types

type HTTPService

type HTTPService struct {
	Scheme string
	// contains filtered or unexported fields
}

func (*HTTPService) Init

func (h *HTTPService) Init(cfg HTTPServiceCfg, layout RouteLayout, rspec *RouterSpec, log *logger.Logger) error

func (*HTTPService) Start

func (h *HTTPService) Start() error

func (*HTTPService) Stop

func (h *HTTPService) Stop() error

type HTTPServiceCfg

type HTTPServiceCfg struct {
	Secure    bool   `json:"secure"`
	Addr      string `json:"addr"`
	Port      int    `json:"port"`
	CertFile  string `json:"cert_file,omitempty"`
	KeyFile   string `json:"key_file,omitempty"`
	SrvPrefix string `json:"service_prefix"`
	Debug     bool   `json:"-"`
}

type HandlerWithError

type HandlerWithError func(http.ResponseWriter, *http.Request) error

func JWTAuth

func JWTAuth(handler HandlerWithError) HandlerWithError

type RouteLayout

type RouteLayout map[string]map[string][]string

first key is endpoint prefix, second key is handler name, value is [http.Method, <endpoint suffix regexp>]

type RouterSpec

type RouterSpec map[string]HandlerWithError

key: handler name * value: func(http.ResponseWriter, *http.Request) error

Jump to

Keyboard shortcuts

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