server

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReqCtx

type ReqCtx interface {
	Request() *fasthttp.Request
	ReadJson(data any) error
	Body() []byte
	SetUserValue(key any, value any)
	UserValue(key any) any
	Telemetry() context.Context
	SetContentType(contentType string)
	SetStatusCode(statusCode int)
	Error(msg string, statusCode int)
	Write(p []byte) (int, error)
	WriteString(s string) (int, error)
	WriteJson(data any) error
}

type ReqHandler

type ReqHandler func(ReqCtx)

type Server

type Server interface {
	SetServerName(name string) Server
	AddRoute(method, path string, handler func(request ReqCtx), middlewares ...func(handler ReqHandler) ReqHandler) Server
	UseState(state state.State) Server
	UseLogger(logger logger.Logger) Server
	UseTelemetry(telemetry telemetry.Telemetry) Server
	UseSwagger() Server
	UseProfiling() Server
	SetListener(listener net.Listener)
	GetListener() net.Listener
	Listen(service, hostname string, port int) <-chan error
	ListenTLS(service, hostname string, port int, certFile, keyFile string) <-chan error
	Serve(service, hostname string, port int, exit chan error) <-chan error
	ServeTLS(service, hostname string, port int, exit chan error, certFile, keyFile string) <-chan error
	Shutdown() error
}

func New

func New() Server

Jump to

Keyboard shortcuts

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