package main import ( "fmt" "fss/core" "log" "net/http" ) // 主函数 func main() { //创建一个文件服务器,会去www目录下找index.html fileServer := http.FileServer(http.Dir("./www")) // 将 "/" 路径映射到文件服务器 http.Handle("/", fileServer) //扫描指定的目录 http.HandleFunc("/sc", core.SerInfo) fmt.Printf("Starting server at port 9099\n") // 启动HTTP服务器并监听端口 80,如果出现错误,则打印错误信息并退出 if err := http.ListenAndServe(":9099", nil); err != nil { log.Fatal(err) } }