This question already has an answer here:
I try to separate internal use and external use API in different port.
For example external in port 80 , and internal in port 5487.
I use github.com/gorilla/mux for url routing.
I try to create two different route
func main() {
internal := mux.NewRouter()
external := mux.NewRouter()
internal.HandleFunc("/foo", logging(foo))
internal.HandleFunc("/bar", logging(bar))
external.HandleFunc("/monitor", monitor())
http.ListenAndServe(":80", internal)
http.ListenAndServe(":8080", external)
}
But it's turn out that the second server is unreachable code.
So how can I create two different port in go ?
Thanks
</div>