go net/http: enhanced ServeMux routing (github.com)
from tedu to webdev on 01 Sep 2023 01:10
https://azorius.net/g/webdev/p/wQ1c3RZF38QKZ8y4HG-go-nethttp-enhanced-ServeMux-routing

We propose to expand the standard HTTP mux's capabilities by adding two features: distinguishing requests based on HTTP method (GET, POST, ...) and supporting wildcards in the matched paths.

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.

#go #webdev

threaded - newest

tedu on 01 Sep 2023 01:13 collapse

I'm interested in seeing where this is going, but wouldn't rush to use it yet, except for experiments.

type ServeMux struct {
	mu   sync.RWMutex
	tree *node
	// Temporary hack to expose pattern matches.
	// This grows without bound!
	matches       map[*http.Request]*match
	conflictCalls atomic.Int32
	index         *index
}

Took a peek at server.go, and still some work to do.