不到十行代碼:
package main
import (
"log"
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("youpath")))
log.Fatal(http.ListenAndServe(":8080", nil))
}
可能需要注意是否可以回溯。
如果可以訪問到父目錄就會有安全問題。
不到十行代碼:
package main
import (
"log"
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("youpath")))
log.Fatal(http.ListenAndServe(":8080", nil))
}
可能需要注意是否可以回溯。
如果可以訪問到父目錄就會有安全問題。