Skip to content

Instantly share code, notes, and snippets.

@aevitas
Created May 13, 2019 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aevitas/e28d19cfedea1a3b8524a86d8453a9c1 to your computer and use it in GitHub Desktop.
Save aevitas/e28d19cfedea1a3b8524a86d8453a9c1 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"net/http"
)
var (
endPoint = "0.0.0.0:5080"
)
func main() {
errorChannel := make(chan error, 10)
http.Handle("/", http.FileServer(http.Dir("./src")))
go func() {
errorChannel <- http.ListenAndServe(endPoint, nil)
}()
fmt.Println("Server is listening on", endPoint)
for {
select {
case err := <-errorChannel:
log.Fatal(err)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment