server

package
v0.0.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ControllersPath = "/api/controllers"
)

Variables

This section is empty.

Functions

func WithControllerHandler added in v0.0.10

func WithControllerHandler(name string, method string, f http.HandlerFunc) func(*Server)

Types

type IndexPageInfo

type IndexPageInfo struct {
	Title          string
	BitbucketURL   string
	ProjectKey     string
	RepositorySlug string
	Versions       []struct {
		Name string
		Path string
	}
}

type Option added in v0.0.10

type Option func(*Server)

type Server

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

func New

func New(

	logger *slog.Logger,

	all fs.FS,

	versions []*Version,

	webFS fs.FS,

	indexTemplate string,

	getInfo func() (*IndexPageInfo, error),

	timeToLive time.Duration,

	cacheMiddleware func(next http.Handler) http.Handler,

	serverOptions ...Option,
) *Server

New creates a new server using

func (*Server) GetVersionNames

func (s *Server) GetVersionNames() []string

GetVersionNames returns an array with the prefixes of the tags

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Versions

func (s *Server) Versions() iter.Seq[string]

Tags returns an iterator, go 1.23.0, just for the fun of it. func (s *Server) Versions() func(yield func(string) bool) bool {

type Version

type Version struct {
	Name string
	Dir  fs.FS
}

Jump to

Keyboard shortcuts

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