httpserver

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentTypeJSONMiddleware added in v0.8.0

func ContentTypeJSONMiddleware(next http.Handler) http.Handler

func LoggingMiddleware added in v0.8.0

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware versão sem configuração (mantida para compatibilidade)

func LoggingMiddlewareWithConfig added in v0.11.0

func LoggingMiddlewareWithConfig(cfg *LoggingMiddlewareConfig) func(http.Handler) http.Handler

LoggingMiddlewareWithConfig retorna um middleware de logging configurável

func New added in v0.1.1

func New(r *mux.Router, conf *config.Config, opts *cors.Options) *http.Server

func NewWithLogConfig added in v0.11.0

func NewWithLogConfig(r *mux.Router, conf *config.Config, opts *cors.Options, logCfg *LoggingMiddlewareConfig) *http.Server

NewWithLogConfig cria um servidor HTTP com configuração customizada de logging

Types

type HttpMsg added in v0.8.0

type HttpMsg struct {
	Msg  string `json:"msg"`
	Code int    `json:"code"`
}
var ErroHttpMsgMethodNotAllowed HttpMsg = HttpMsg{
	Msg:  "Erro Method Not Allowed",
	Code: http.StatusMethodNotAllowed,
}
var ErroHttpMsgPageNotFound HttpMsg = HttpMsg{
	Msg:  "Erro Page Not Found",
	Code: http.StatusNotFound,
}

func (*HttpMsg) Write added in v0.8.0

func (m *HttpMsg) Write(w http.ResponseWriter)

type LoggingMiddlewareConfig added in v0.11.0

type LoggingMiddlewareConfig struct {
	// IgnorePaths lista de prefixos de paths que NÃO devem gerar logs
	// Exemplo: []string{"/assets/", "/static/", "/favicon.ico"}
	IgnorePaths []string
	// Enabled habilita ou desabilita completamente o logging (padrão: true)
	Enabled bool
}

LoggingMiddlewareConfig configuração para o middleware de logging

Jump to

Keyboard shortcuts

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