middleware

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain added in v0.0.7

func Chain(next http.Handler, ms ...Middleware) http.Handler

Chain creates a chain of HTTP middleware functions to wrap around a http.Handler. It applies each middleware in the order they are provided, allowing for layered processing of HTTP requests and responses.

func ExactPath

func ExactPath(path string, next http.Handler) http.Handler

ExactPath creates a middleware that checks if the request's path exactly matches the given path. If the path does not match, it returns a 404 Not Found response. Otherwise, it passes the request to the next handler in the chain.

func Logging added in v0.0.8

func Logging(log logger.Logger) func(http.Handler) http.Handler

Logging creates a logging middleware with a custom logger

func Sessioned

func Sessioned(e session.Engine) func(http.Handler) http.Handler

Sessioned returns a middleware that manages session cookies using the provided session Engine. It checks for existing cookies, creates new ones if necessary, and associates session data with the request context before passing it to the next handler.

Types

type Middleware added in v0.0.7

type Middleware func(http.Handler) http.Handler

Middleware represents a function that can wrap a http.Handler with additional functionality. It takes a http.Handler and returns a new http.Handler that includes the middleware's behavior.

Jump to

Keyboard shortcuts

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