When I use
http.HandleFunc(\"/\", serveRest) //serveRest is the method to handle request
http.ListenAndServe(\"localhost:4000\", nil)
It will
You could check out https://github.com/julienschmidt/httprouter
Per its readme:
Only explicit matches: With other routers, like http.ServeMux, a requested URL path could match multiple patterns. Therefore they have some awkward pattern priority rules, like longest match or first registered, first matched. By design of this router, a request can only match exactly one or no route. As a result, there are also no unintended matches, which makes it great for SEO and improves the user experience.
Here is some good video content to get started in Go.