1

I'm doing a project on Martini, and i have my static files (css,js) on a static folder at root folder, and i have my templates with this structure:

--static

--templates

----services/format.html

----index.html

----layout.html

And the handlers for those templates are these:

package services

import (
    "github.com/martini-contrib/render"
)

func IndexHandler(rnd render.Render) {
    rnd.HTML(200, "index", nil)
}

func FormatHandler(rnd render.Render) {
    rnd.HTML(200, "services/format", nil)
}

The problem is, the template rendered with IndexHandler, pointing to index.html looks for static files on /static, and it works. But the template rendered with FormatHandler looks for static files on /serviciosti/static and that folder does not exists. The static use and gets are something like this:

staticOptions := martini.StaticOptions{Prefix: "static"}
m.Use(martini.Static("static", staticOptions))

/**
* Main Handlers
* m.Get("link", handler)
*/
m.Get("/serviciosti", services.IndexHandler)
m.Group("/serviciosti", func(r martini.Router) {
    r.Get("/formato", services.FormatHandler)
})

Any help is appreciated, thanks!

4

0 回答 0