16 Star 55 Fork 29

光宇开源 / SmartPing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.go 453 Bytes
一键复制 编辑 原始数据 按行查看 历史
ToryZen 提交于 2017-09-16 16:33 . v0.3.0 pre release
package http
import (
"../g"
"github.com/gy-games-libs/file"
"net/http"
"path/filepath"
"strings"
)
func configIndexRoutes() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/") {
if !file.IsExist(filepath.Join(g.Root, "/html", r.URL.Path, "index.html")) {
http.NotFound(w, r)
return
}
}
http.FileServer(http.Dir(filepath.Join(g.Root, "/html"))).ServeHTTP(w, r)
})
}
Go
1
https://gitee.com/gy-games/smartping.git
git@gitee.com:gy-games/smartping.git
gy-games
smartping
SmartPing
v0.4.1

搜索帮助