I need to set default page "index.html" located in "public" folder. How I can do this in Martini framework?
I tryed this, but it doesn't work:
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()
}
You're doing it correctly. Check if you really have an index.html in public/ folder and it's accessible.
Currently, if the fallback file is inaccessible, error is silently discarded.