Help us shape the future of Go! Take the 2026 Go Developer Survey

bettermux

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 2 Imported by: 0

README

bettermux

一个完全基于 Go 自带的 http.ServeMux 实现分组路由与中间件包装的低开销路由框架

0 运行时开销, 本模块逻辑只在路由构建时运行

API 类似 chi

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BetterMux

type BetterMux struct {
	RealMux    *http.ServeMux
	ParentMux  *BetterMux
	Middleware func(http.Handler) http.Handler
}

func NewBetterMux added in v1.1.0

func NewBetterMux() *BetterMux

func NewBetterMuxWithServeMux added in v1.1.0

func NewBetterMuxWithServeMux(mux *http.ServeMux) *BetterMux

func (*BetterMux) Delete

func (mux *BetterMux) Delete(pattern string, handler http.HandlerFunc)

func (*BetterMux) Get

func (mux *BetterMux) Get(pattern string, handler http.HandlerFunc)

func (*BetterMux) Handle

func (mux *BetterMux) Handle(pattern string, handler http.Handler)

func (*BetterMux) HandleFunc

func (mux *BetterMux) HandleFunc(pattern string, fn http.HandlerFunc)

func (*BetterMux) Mount added in v1.1.0

func (mux *BetterMux) Mount(path string, handler http.Handler)

func (*BetterMux) Options

func (mux *BetterMux) Options(pattern string, handler http.HandlerFunc)

func (*BetterMux) Patch

func (mux *BetterMux) Patch(pattern string, handler http.HandlerFunc)

func (*BetterMux) Post

func (mux *BetterMux) Post(pattern string, handler http.HandlerFunc)

func (*BetterMux) Put

func (mux *BetterMux) Put(pattern string, handler http.HandlerFunc)

func (*BetterMux) Route

func (mux *BetterMux) Route(path string, fn func(*BetterMux)) *BetterMux

func (*BetterMux) ServeHTTP

func (mux *BetterMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*BetterMux) With

func (mux *BetterMux) With(mfn func(http.Handler) http.Handler) *BetterMux

Jump to

Keyboard shortcuts

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