Created
March 21, 2017 04:01
-
-
Save josephspurrier/f1c656b163ba1961050d6a540d9af4ac to your computer and use it in GitHub Desktop.
Simple Web Server in Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/", index) | |
http.ListenAndServe(":8080", nil) | |
} | |
func index(w http.ResponseWriter, r *http.Request) { | |
io.WriteString(w, "Hello world!") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment