Tagged articles

ServeMux

2 articles · Page 1 of 1
FunTester
FunTester
Jul 22, 2025 · Backend Development

Mastering Go's ServeMux: Custom Handlers, Redirects, and Closures

This guide explains Go's net/http ServeMux as a request router, demonstrates built‑in handlers like RedirectHandler, shows how to create custom http.Handler implementations, use functions as handlers, and pass variables via closures, complete with runnable code examples.

Custom HandlerGoHTTP handlers
0 likes · 8 min read
Mastering Go's ServeMux: Custom Handlers, Redirects, and Closures
Nullbody Notes
Nullbody Notes
Jun 17, 2024 · Backend Development

How Go’s HTTP Standard Library Is Implemented

This article walks through Go’s net/http package, explaining how http.HandleFunc registers handlers via DefaultServeMux, how ServeMux stores routes, performs exact and longest‑prefix matching, and how to extend the server with custom ServeMux and middleware for panic recovery and request timing.

DefaultServeMuxGoMiddleware
0 likes · 17 min read
How Go’s HTTP Standard Library Is Implemented