lab-development-imb/web/07/demos/01_helloworld_http.go

18 lines
277 B
Go

package main
import (
"fmt"
"net/http"
)
type helloHandler int
func (hello helloHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World %d!", hello)
}
func main() {
var world helloHandler
http.ListenAndServe("localhost:8080", world)
}