api

package
v0.0.0-...-bc24f03 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestIDHeader = "X-Request-ID"

Functions

func BootstrapLogger

func BootstrapLogger(level slog.Level, format LoggingFormat, colorize bool) *slog.Logger

func CorsMiddleware

func CorsMiddleware(origin string) alice.Constructor

func LoggingMiddleware

func LoggingMiddleware(logger *slog.Logger) alice.Constructor

func RequestIdMiddleware

func RequestIdMiddleware() alice.Constructor

func RootMiddleware

func RootMiddleware(logger *slog.Logger, origin string) alice.Chain

Types

type LoggingFormat

type LoggingFormat string
const (
	JSONFormat LoggingFormat = "json"
	TextFormat LoggingFormat = "text"
)

type RequestLoggerContextKey

type RequestLoggerContextKey string
const RequestLoggerKey RequestLoggerContextKey = "logger"

type SampleHandler

type SampleHandler struct{}

func (*SampleHandler) SampleMethod

type Server

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

func NewServer

func NewServer(cfg ServerConfig) *Server

func (*Server) MountHandlers

func (s *Server) MountHandlers()

func (*Server) Start

func (s *Server) Start() error

type ServerConfig

type ServerConfig struct {
	Port         string
	LogLevel     slog.Level
	AllowedHosts []string
}

Jump to

Keyboard shortcuts

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