middleware

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionalMiddleware

type ConditionalMiddleware struct {
	Pattern    string     // The URL path pattern to match, e.g., "/api/v1/*"
	Middleware Middleware // The middleware function to apply when the pattern matches
}

ConditionalMiddleware pairs a middleware with a path pattern. The middleware is only applied if the request path matches the pattern. Patterns can use a wildcard '*' at the end to match any subpath.

type Middleware

type Middleware func(server.HandlerFunc) server.HandlerFunc

Middleware defines the function signature for all middleware in OneStrike. A middleware wraps a HandlerFunc, allowing pre- or post-processing of requests. Example: logging, authentication, profiling, or panic recovery.

func Logger

func Logger() Middleware

Logging

func ProfilingMiddleware

func ProfilingMiddleware() Middleware

ProfilingMiddleware logs detailed timing info including handler execution and memory usage

func Recovery

func Recovery() Middleware

Panic Recovery Recovery returns a middleware that recovers from panics and writes a 500 response.

Jump to

Keyboard shortcuts

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