Versions in this module Expand all Collapse all v0 v0.1.0 Jan 17, 2026 Changes in this version + const DefaultMultipartMemory + const RequestIDHeader + const TraceparentHeader + const TracestateHeader + var ErrRegistryExists = errors.New("registry entry already exists") + var ErrRegistryNameRequired = errors.New("registry name is required") + var ErrRegistryNil = errors.New("registry is nil") + var ErrRegistryNotFound = errors.New("registry entry not found") + func ConfigFromEnv(prefix string, base config.Config) config.Config + func ConfigFromFile(path string, base config.Config) (config.Config, error) + func DefaultConfig() config.Config + func InjectRequestMetadata(r *http.Request, metadata RequestMetadata) + func InjectRequestMetadataIfMissing(r *http.Request, metadata RequestMetadata) + func LoadConfig(path, envPrefix string) (config.Config, error) + func LoadConfigProfile(profile config.Profile) (config.Config, error) + func NewRequestID() string + func RequestIDFromHeader(r *http.Request) string + func SetPrincipal(ctx *Context, principal *Principal) + func TraceIDs(traceparent string) (string, string, bool) + func ValidateConfig(cfg config.Config) error + func WithRequestMetadata(ctx context.Context, metadata RequestMetadata) context.Context + type App struct + func New(options ...Option) *App + func (a *App) AddOpenAPIRoutes(builder *openapi.Builder, options ...OpenAPIOption) error + func (a *App) AuthHooks() AuthHooks + func (a *App) DELETE(path string, handler Handler, middleware ...Middleware) + func (a *App) File(route, filePath string, options ...StaticOption) + func (a *App) GET(path string, handler Handler, middleware ...Middleware) + func (a *App) Group(prefix string, middleware ...Middleware) *Group + func (a *App) HEAD(path string, handler Handler, middleware ...Middleware) + func (a *App) Handle(method, path string, handler Handler, middleware ...Middleware) + func (a *App) ListenAndServe() error + func (a *App) ListenAndServeTLS(certFile, keyFile string) error + func (a *App) PATCH(path string, handler Handler, middleware ...Middleware) + func (a *App) POST(path string, handler Handler, middleware ...Middleware) + func (a *App) PUT(path string, handler Handler, middleware ...Middleware) + func (a *App) Path(name string, params map[string]string) (string, bool) + func (a *App) PathWithQuery(name string, params map[string]string, query map[string]string) (string, bool) + func (a *App) Registry() *Registry + func (a *App) Route(method, path string, handler Handler, options ...RouteOption) + func (a *App) RouteInfo(name string) (RouteInfo, bool) + func (a *App) Routes() []RouteInfo + func (a *App) RoutesAll() []RouteInfo + func (a *App) Run(ctx context.Context) error + func (a *App) RunWithSignals() error + func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (a *App) SetAuthHooks(hooks AuthHooks) + func (a *App) ShutdownTimeout() time.Duration + func (a *App) Static(prefix, dir string, options ...StaticOption) + func (a *App) StaticFS(prefix string, fsys fs.FS, options ...StaticOption) + func (a *App) Use(middleware ...Middleware) + func (a *App) UsePre(middleware ...PreMiddleware) + func (a *App) Version(version string, middleware ...Middleware) *Group + type AuthHooks struct + AfterAuthenticate func(ctx *Context, principal *Principal, err error) + BeforeAuthenticate func(ctx *Context) + type Authenticator interface + Authenticate func(*Context) (*Principal, error) + type AuthenticatorFactory func(config map[string]any) (Authenticator, error) + type Authorizer interface + Authorize func(*Context, *Principal) error + type CacheFactory func(config map[string]any) (cache.Store, error) + type Config = config.Config + type ConfigProfile = config.Profile + type Context struct + Params router.Params + Request *http.Request + ResponseWriter http.ResponseWriter + func NewContext(w http.ResponseWriter, r *http.Request, params router.Params, app *App) *Context + func (c *Context) App() *App + func (c *Context) AuthHooks() AuthHooks + func (c *Context) BindForm(dst any) error + func (c *Context) BindJSON(dst any) error + func (c *Context) BindMultipart(dst any, maxMemory int64) error + func (c *Context) FormFile(name string, maxMemory int64) (*multipart.FileHeader, error) + func (c *Context) Get(key string) (any, bool) + func (c *Context) HTML(status int, name string, data any) error + func (c *Context) JSON(status int, payload any) error + func (c *Context) Logger() Logger + func (c *Context) Param(name string) string + func (c *Context) ParamBool(name string) (bool, error) + func (c *Context) ParamInt(name string) (int, error) + func (c *Context) ParamInt64(name string) (int64, error) + func (c *Context) Query(name string) string + func (c *Context) QueryBool(name string) (bool, error) + func (c *Context) QueryInt(name string) (int, error) + func (c *Context) QueryInt64(name string) (int64, error) + func (c *Context) Render(status int, fn render.RenderFunc) error + func (c *Context) RequestID() string + func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error + func (c *Context) Set(key string, value any) + func (c *Context) Text(status int, message string) error + type ErrorEnvelope struct + Code string + Fields []validate.FieldError + Message string + RequestID string + type ErrorHandler func(*Context, error) + type ErrorPageData struct + Code string + Error ErrorEnvelope + Fields []validate.FieldError + Message string + RequestID string + Status int + type Group struct + func (g *Group) DELETE(path string, handler Handler, middleware ...Middleware) + func (g *Group) GET(path string, handler Handler, middleware ...Middleware) + func (g *Group) Group(prefix string, middleware ...Middleware) *Group + func (g *Group) HEAD(path string, handler Handler, middleware ...Middleware) + func (g *Group) Handle(method, path string, handler Handler, middleware ...Middleware) + func (g *Group) PATCH(path string, handler Handler, middleware ...Middleware) + func (g *Group) POST(path string, handler Handler, middleware ...Middleware) + func (g *Group) PUT(path string, handler Handler, middleware ...Middleware) + func (g *Group) Route(method, path string, handler Handler, options ...RouteOption) + type Handler func(*Context) error + func TimeoutHandler(next Handler, duration time.Duration) Handler + type Logger struct + func LoggerFromContext(ctx context.Context, logger *slog.Logger) Logger + func LoggerFromRequest(r *http.Request, logger *slog.Logger) Logger + func (l Logger) Debug(msg string, attrs ...slog.Attr) + func (l Logger) Error(msg string, attrs ...slog.Attr) + func (l Logger) Info(msg string, attrs ...slog.Attr) + func (l Logger) Warn(msg string, attrs ...slog.Attr) + type Middleware func(Handler) Handler + type MiddlewareFactory func(config map[string]any) (Middleware, error) + type OpenAPIOption func(*OpenAPIOptions) + func WithOpenAPIIncludeUnnamed(enabled bool) OpenAPIOption + func WithOpenAPISkipMethods(methods ...string) OpenAPIOption + func WithOpenAPISkipPaths(paths ...string) OpenAPIOption + func WithOpenAPITagFromHost(enabled bool) OpenAPIOption + type OpenAPIOptions struct + IncludeUnnamed bool + SkipMethods []string + SkipPaths []string + TagFromHost bool + func DefaultOpenAPIOptions() OpenAPIOptions + type Option func(*App) + func WithAuthHooks(hooks AuthHooks) Option + func WithConfig(cfg config.Config) Option + func WithErrorHandler(handler ErrorHandler) Option + func WithErrorTemplates(templates map[int]string) Option + func WithLogger(logger *slog.Logger) Option + func WithRegistry(registry *Registry) Option + func WithRenderer(engine *render.Engine) Option + func WithTemplateFS(fsys fs.FS, dir string) Option + func WithTemplateFSDevDir(dir string) Option + func WithTemplateFuncs(funcs render.FuncMap) Option + func WithTemplatePartials(patterns ...string) Option + func WithTemplateReload(enabled bool) Option + func WithTemplateSubdirs(enabled bool) Option + type Params = router.Params + type Plugin interface + Name func() string + Register func(*Registry) error + type PreMiddleware func(*Context) error + type Principal struct + Claims map[string]any + ID string + Roles []string + func PrincipalFromContext(ctx *Context) (*Principal, bool) + type Registry struct + func NewRegistry() *Registry + func (r *Registry) Authenticator(name string, config map[string]any) (Authenticator, error) + func (r *Registry) Cache(name string, config map[string]any) (cache.Store, error) + func (r *Registry) Middleware(name string, config map[string]any) (Middleware, error) + func (r *Registry) RegisterAuthenticator(name string, factory AuthenticatorFactory) error + func (r *Registry) RegisterCache(name string, factory CacheFactory) error + func (r *Registry) RegisterMiddleware(name string, factory MiddlewareFactory) error + func (r *Registry) RegisterValidator(name string, fn validate.ValidatorFunc) error + func (r *Registry) Use(plugin Plugin) error + func (r *Registry) Validator(name string) (validate.ValidatorFunc, error) + type RequestMetadata struct + RequestID string + Traceparent string + Tracestate string + func RequestMetadataFromContext(ctx context.Context) RequestMetadata + func RequestMetadataFromRequest(r *http.Request) RequestMetadata + type RouteInfo struct + Host string + Method string + Name string + Pattern string + type RouteOption func(*routeConfig) + func WithHost(host string) RouteOption + func WithMiddleware(middleware ...Middleware) RouteOption + func WithName(name string) RouteOption + func WithTimeout(timeout time.Duration) RouteOption + type StaticOption func(*staticConfig) + func StaticCacheControl(value string) StaticOption + func StaticETag(enabled bool) StaticOption + func StaticIndex(name string) StaticOption