Skip to content

Commit

Permalink
serve on multiple ports
Browse files Browse the repository at this point in the history
  • Loading branch information
pweil- committed Apr 21, 2015
1 parent 01be84b commit 7719a17
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions examples/hello-openshift/hello_openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,21 @@ func helloHandler(w http.ResponseWriter, r *http.Request) {
func main() {
http.HandleFunc("/", helloHandler)

fmt.Println("Started, serving at 8080")
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic("ListenAndServe: " + err.Error())
}
go func() {
fmt.Println("serving on 8080")
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic("ListenAndServe: " + err.Error())
}
}()


go func() {
fmt.Println("serving on 8888")
err := http.ListenAndServe(":8888", nil)
if err != nil {
panic("ListenAndServe: " + err.Error())
}
}()
select{}
}

0 comments on commit 7719a17

Please sign in to comment.