1 package main
 2 
 3 import (
 4     "io/ioutil"
 5     "log"
 6     "net/http"
 7 )
 8 
 9 func main() {
10     http.HandleFunc("/", ShowIndex)
11     log.Fatal(http.ListenAndServe("localhost:8000", nil))
12 }
13 
14 func ShowIndex(w http.ResponseWriter, r *http.Request) {
15     content, _ := ioutil.ReadFile("./index.html")
16     w.Write(content)
17 }
18 //在浏览器上输入 localhost:8000 就可以显示 index.html