app

package
v0.0.0-...-a629a05 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(config LoggingConfig)

InitLogger initializes log/slog with a zerolog backend

func LogRequest

func LogRequest(next http.Handler) http.Handler

LogRequest logs the incoming HTTP requests

func LogResponse

func LogResponse(next http.Handler) http.Handler

LogResponse logs the HTTP responses

func WriteOut

func WriteOut(w http.ResponseWriter, status int, body *BaseResponse)

WriteOut writes the response to the client

Types

type AuthzServer

type AuthzServer struct {
	*http.Server
	Addr    string
	Handler http.Handler
	Mux     *http.ServeMux
}

AuthzServer is the HTTP server

func NewAuthzServer

func NewAuthzServer(bind string, port int, handler http.Handler, mux *http.ServeMux) *AuthzServer

NewAuthzServer creates a new HTTP server

func (*AuthzServer) RegisterRoutes

func (s *AuthzServer) RegisterRoutes(wantAuthzHeader string)

RegisterRoutes registers the routes

type BaseResponse

type BaseResponse struct {
	Message string `json:"message"`
}

BaseResponse is the base response

type LoggingConfig

type LoggingConfig struct {
	Format string
	Level  string
}

LoggingConfig holds the configuration for the logger.

Jump to

Keyboard shortcuts

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