How to set default static page in Martini?

329 views Asked by At

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()
}
1

There are 1 answers

2
divan On

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.