package main import ( "log" "net/http" "tplate/tool" ) func main() { assets := http.FileServer(http.Dir("./assets")) http.Handle("/assets/", http.StripPrefix("/assets/", assets)) img := http.FileServer(http.Dir("./images")) http.Handle("/images/", http.StripPrefix("/images/", img)) http.HandleFunc("/", tool.MainHandler) log.Println("服务器启动,访问 http://localhost:8080 进行预览") log.Fatal(http.ListenAndServe(":8080", nil)) }