Hi
You don’t need gorilla mux (not for this at least). Because standard http package can create multiple multiplexers
package main
import (
"io"
"net/http"
)
func index1(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello from server 1")
}
func index2(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello from server 2")
}
func main() {
mux1 := http.NewServeMux()
mux1.HandleFunc("/", index1)
mux2 := http.NewServeMux()
mux2.HandleFunc("/", index2)
go http.ListenAndServe("localhost:8001", mux1)
http.ListenAndServe("localhost:8002", mux2)
}