草庐IT

sftablet

全部标签

go - 使用 gorilla mux 指向域去服务器

我有一个小型服务器,我希望该服务器使用gorilla/mux包监听我的自定义域sftablet.dev。代码如下:packagemainimport("fmt""net/http""github.com/gorilla/mux")funcmain(){r:=mux.NewRouter()r.Host("sftablet.dev")r.HandleFunc("/",HomeHandler)r.HandleFunc("/products",ProductsHandler)http.ListenAndServe(":8080",r)}funcHomeHandler(whttp.Respons