Created
January 20, 2016 11:50
-
-
Save shijuvar/85f96c913addb44365ec to your computer and use it in GitHub Desktop.
HTTP Server with http.HandleFunc
This file contains 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 ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func indexHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Welcome to Go Web Development") | |
} | |
func main() { | |
http.HandleFunc("/", indexHandler) | |
log.Println("Listening...") | |
http.ListenAndServe(":8080", nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment