Running multiple HTTP servers in Go Following is the working example for running application over http port(s) 8081 and 8082: package main import (

GOLANG: Running multiple HTTP servers in Go

submited by
Style Pass
2020-06-25 19:20:05
Running multiple HTTP servers in Go Following is the working example for running application over http port(s) 8081 and 8082: package main import ( "fmt" "net/http" ) func hello(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "hello") } func world(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "world") } func main() { serverMuxA := http.NewServeMux() serverMuxA.HandleFunc("/hello", hello) serverMuxB :=…
Leave a Comment