Up until now, we鈥檝e been using the DefaultServeMux, but it鈥檚 time to wield more control and precision by explicitly using the http.ServeMux. Plus, we鈥檒l look at the powerful frameworks available, like Gorilla Mux and Echo, that take web server functionality to new heights.
Check out previous posts:
Part 1: https://surajincloud.com/understanding-http-server-in-go-basic Part 2: https://surajincloud.com/understanding-http-server-in-go-using-httpserver-struct Part 3: https://surajincloud.com/understanding-http-server-in-go-handlers Part 4: https://surajincloud.com/understanding-http-server-in-go-multiple-handlers Part 5: https://surajincloud.com/understanding-http-server-in-go-handlefunc Why do we need this? While the DefaultServeMux In Golang does a great job of handling basic routing, there will come a point where you鈥檒l want more control over your application鈥檚 routes. This is where the http.ServeMux steps in. It empowers you to explicitly define how your application responds to different routes, giving you fine-grained control over your server鈥檚 behaviour.
...