go 静态web服务器

package main

import (
	"net/http"
)

type helloHandler struct{}

func (h *helloHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	w.Write([]byte("Hello, world!DAVID!"))
}

func main() {
	http.Handle("/", &helloHandler{})
	http.ListenAndServe(":12345", nil)
}

http://127.0.0.1:12345

原文地址:https://www.cnblogs.com/chunyou128/p/6041010.html