Created
December 31, 2016 16:58
-
-
Save sromku/02ecd740bf19a4645a7e622b329a757c to your computer and use it in GitHub Desktop.
Multiple server ports for the same shared app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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