Golang http 服务器

package main

import (
	"net/http"
	"fmt"
)

func main() {
	app := http.NewServeMux()
	app.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintln(w,fmt.Sprint("Method:",r.Method))
		fmt.Fprintln(w,"Hello World")
	})
	http.ListenAndServe("127.0.0.1:8080", app)
}
原文地址:https://www.cnblogs.com/cheungxiongwei/p/8454199.html