Skip to content

Instantly share code, notes, and snippets.

@mchirico
Last active August 27, 2020 13:19
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 mchirico/233379462bf2b561a180b58b925dd37e to your computer and use it in GitHub Desktop.
Save mchirico/233379462bf2b561a180b58b925dd37e to your computer and use it in GitHub Desktop.
Simple Go Web Server
package main
import (
"log"
"net/http"
)
func main() {
log.Println("starting server...")
http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`Hello world`))
})
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment