Given a url string, how to retrieve only the base url (i.e. protocol://host:port)
For example
https://localhost:8080/user/1000/profile => https://localhost:8080
I've tried parsing the url with url.Parse() but the net/url doesn't seem to have a method that returns the base url. I could try appending the individual parts of url to get the base url but I just wanted to check if there are any better alternatives to this.