middlewares

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(allowedOrigins []string, allowedMethods []string, allowedHeaders []string) feather.HandlerFunc

CORS is a middleware function that sets Cross-Origin Resource Sharing (CORS) headers on HTTP responses. It allows the server to specify which origins, methods, and headers are permitted for cross-origin requests.

Parameters:

  • allowedOrigins: A slice of strings specifying the allowed origins.
  • allowedMethods: A slice of strings specifying the allowed HTTP methods.
  • allowedHeaders: A slice of strings specifying the allowed HTTP headers.

Returns:

  • A feather.HandlerFunc that applies the CORS headers to the HTTP response.

func Logging

func Logging() feather.HandlerFunc

Logging is a middleware function that logs HTTP requests and responses in a structured format. It provides details such as the timestamp, HTTP status code, client IP, HTTP method, request path, and response time.

Parameters: - None

Returns: - feather.HandlerFunc: A function that can be used as middleware in a Feather application.

func Recover

func Recover() feather.HandlerFunc

func RequestID

func RequestID() feather.HandlerFunc

Types

type CustomLogger added in v1.0.1

type CustomLogger struct{}

func (*CustomLogger) Error added in v1.0.1

func (l *CustomLogger) Error(format string, args ...any)

func (*CustomLogger) Fatal added in v1.0.1

func (l *CustomLogger) Fatal(format string, args ...any)

func (*CustomLogger) Info added in v1.0.1

func (l *CustomLogger) Info(format string, args ...any)

Jump to

Keyboard shortcuts

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