Created
December 5, 2018 09:36
-
-
Save sonyarianto/490999458905896135d16c1ddad92a7b to your computer and use it in GitHub Desktop.
Hello World on web
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 ( | |
"io" | |
"log" | |
"net/http" | |
) | |
func Default(w http.ResponseWriter, r *http.Request) { | |
if r.URL.Path != "/" { | |
http.NotFound(w, r) | |
return | |
} | |
io.WriteString(w, "hello, world") | |
} | |
func main() { | |
http.HandleFunc("/", Default) | |
log.Fatal(http.ListenAndServe(":3000", nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment