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)
}
posted @ 2018-02-19 18:33  學海無涯  阅读(161)  评论(0编辑  收藏  举报