server

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessLog added in v0.21.0

func AccessLog(log *slog.Logger) echo.MiddlewareFunc

AccessLog writes the one result record for each request: the access fields, and for a failed request the error fields of its attribution. It recovers a panic into an error with the stack of the panic, and answers an error that is still unanswered through the shell's HTTP error handler, so the record carries the status that was sent.

Install it directly after telemetry.EchoServer, so the record is logged with the request's span and every middleware below it is covered.

func NewHTTPErrorHandler added in v0.21.0

func NewHTTPErrorHandler(log *slog.Logger) echo.HTTPErrorHandler

NewHTTPErrorHandler renders every error a request ends with as a Problem. It does not log the error: the access log writes the one result record for the request. An HTTP shell installs it together with AccessLog.

func PublicError added in v0.21.0

func PublicError(ctx context.Context, err error) (public *apperror.Error, recorded error)

PublicError is the public error a transport answers err with, and the error its result record attributes, chosen by the rule the HTTP error handler applies. A WebSocket handler renders its error frames from it, so a request is answered with the same code whichever transport carried it.

Types

type Handler

type Handler interface {
	Register(e *echo.Echo)
}

type Server

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

func NewServer

func NewServer(log *slog.Logger, addr string, jwtSecret string,
	handlers ...Handler,
) *Server

func NewServerWithSessionValidator

func NewServerWithSessionValidator(log *slog.Logger, addr string, jwtSecret string,
	validateSession auth.UserSessionValidator, handlers ...Handler,
) *Server

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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