Skip to content

Instantly share code, notes, and snippets.

@koyo-miyamura
Created April 27, 2019 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koyo-miyamura/bae26b8ff957f40fb08ae7209975464a to your computer and use it in GitHub Desktop.
Save koyo-miyamura/bae26b8ff957f40fb08ae7209975464a to your computer and use it in GitHub Desktop.
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