Skip to content

Instantly share code, notes, and snippets.

@kaperys
Created February 14, 2018 09:54
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 kaperys/b30dc473f3476419600c8842a4298059 to your computer and use it in GitHub Desktop.
Save kaperys/b30dc473f3476419600c8842a4298059 to your computer and use it in GitHub Desktop.
Simple golang HTTP server
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello World")
})
if err := http.ListenAndServe(":8080", nil); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment