我需要设置位于“公共”文件夹中的默认页面"index.html“。我如何在Martini框架中做到这一点?
我试过了,但不起作用:
func main() {
m := martini.Classic()
static := martini.Static("public", martini.StaticOptions{Fallback: "/index.html", Exclude: "/send"})
m.NotFound(static, http.NotFound)
m.Use(static)
m.Get("/send", sendEmail)
m.Run()
}发布于 2014-11-25 11:15:07
你这样做是正确的。检查你是否真的在公共/文件夹中有一个index.html并且它是可访问的。
目前,如果回退文件不可访问,错误将被自动丢弃。
https://stackoverflow.com/questions/27115823
复制相似问题