Browse Source

Step 3

step3
Levi Olson 6 years ago
parent
commit
e636b12330
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      main.go

+ 5
- 0
main.go View File

@ -8,9 +8,14 @@ import (
func main() { func main() {
http.HandleFunc("/hello", HelloHTTP) http.HandleFunc("/hello", HelloHTTP)
http.HandleFunc("/", NotFound)
log.Fatal(http.ListenAndServe(":8080", nil)) log.Fatal(http.ListenAndServe(":8080", nil))
} }
func HelloHTTP(w http.ResponseWriter, req *http.Request) { func HelloHTTP(w http.ResponseWriter, req *http.Request) {
fmt.Fprint(w, "Hello HTTP") fmt.Fprint(w, "Hello HTTP")
} }
func NotFound(w http.ResponseWriter, req *http.Request) {
http.NotFound(w, req)
}

Loading…
Cancel
Save