Skip to content

Instantly share code, notes, and snippets.

@sromku
Created December 31, 2016 16:58
Show Gist options
  • Save sromku/02ecd740bf19a4645a7e622b329a757c to your computer and use it in GitHub Desktop.
Save sromku/02ecd740bf19a4645a7e622b329a757c to your computer and use it in GitHub Desktop.
Multiple server ports for the same shared app.
func startServer(port string) {
log.Println("Starting on port: " + port)
serverMux := http.NewServeMux()
serverMux.HandleFunc("/", handle)
log.Println("ERROR: " + http.ListenAndServe(":" + port, serverMux).Error())
}
func main() {
go startServer("4040")
go startServer("4041")
time.Sleep(10 * time.Minute)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment