1. package main
    2. import (
    3. "fmt"
    4. "net/http"
    5. )
    6. func main() {
    7. http.HandleFunc("/", MyHandler1)
    8. http.HandleFunc("/John", MyHandler2)
    9. http.ListenAndServe(":8080", nil)
    10. }
    11. func MyHandler1(w http.ResponseWriter, r *http.Request){
    12. fmt.Fprint(w, "Hello World\n")
    13. }
    14. func MyHandler2(w http.ResponseWriter, r *http.Request){
    15. fmt.Fprint(w, "Hello John\n")
    16. }