Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package main
import (
"fmt"
"log"
"net/http"
)
// type app struct {
// Name string
// }
// func (myApp app) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// fmt.Fprintln(w, "hello from", myApp.Name)
// }
func main() {
// server := http.NewServeMux()
// server.Handle("/", app{"my app"})
// if err := http.ListenAndServe(":8080", server); err != nil {
// log.Fatal(err)
// }
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello")
})
if err := http.ListenAndServe(":8080", nil); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment