1
0
Fork 0
mirror of https://github.com/vbatts/talks.git synced 2024-12-27 09:06:30 +00:00
talks/2013/03-golang-learning-lunch/9-http-srv/main.go

21 lines
376 B
Go

package main
import (
"fmt"
"log"
"net/http"
)
// START OMIT
func routeSlash(w http.ResponseWriter, r *http.Request) {
log.Printf("Got a request from %s", r.RemoteAddr)
fmt.Fprintf(w, "It Works!\n")
}
func main() {
log.Println("listening on 0.0.0.0:4000")
http.HandleFunc("/", routeSlash)
log.Fatal(http.ListenAndServe("0.0.0.0:4000", nil))
}
// STOP OMIT