httpsrv

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TryFile

func TryFile(req *http.Request, d fs.FS)

TryFile If the file does not exist, return root index.html 需要结合 http.FileServer 使用

func WrapEtagHandler

func WrapEtagHandler(root http.Handler) http.Handler

Types

type Service

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

Service 支持 Start(ctx)

func NewService

func NewService(addr string) (*Service, error)

func (*Service) Handler

func (s *Service) Handler(path string, h http.Handler)

func (*Service) HandlerFunc

func (s *Service) HandlerFunc(path string, f func(writer http.ResponseWriter, request *http.Request))

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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