Created
July 23, 2018 08:06
-
-
Save fwojciec/a1d0c9f71e6696677e00be9e3b8bdabf to your computer and use it in GitHub Desktop.
My solution to "Exercise Bye, web" from Section 02 of Francesc Campoy's Go Web Workshop
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
// https://github.com/campoy/go-web-workshop/blob/master/section02/README.md | |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func helloHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintln(w, "Hello, web") | |
} | |
func byeHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintln(w, "Bye, web") | |
} | |
func main() { | |
http.HandleFunc("/hello", helloHandler) | |
http.HandleFunc("/bye", byeHandler) | |
err := http.ListenAndServe(":8080", nil) | |
if err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment