程序会监听8080端口,然后简单的返回web/路径下的文件,假如只输入类似localhost:8080,会自动找到index.html
package main import ( "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("web/"))) http.ListenAndServe(":8080", nil) }
程序会监听8080端口,然后简单的返回web/路径下的文件,假如只输入类似localhost:8080,会自动找到index.html
package main import ( "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("web/"))) http.ListenAndServe(":8080", nil) }