Will an absolute path work for the static directory?
ianwalter opened this issue · comments
Ian Walter commented
Specifying an absolute path of a directory outside of the project doesn't seem to be working for me:
m.Use(martini.Static("/Users/ian/frontend/dist"))
While a directory within the project does.
Allan Larangeiras commented
Hi Ian,
Actually martini.Static accepts not only relative paths but absolute too.
Have you sure that path exists in your system?
A saw the code that treats absolute path. In addtition I did a POC in a Linux system.
// Static returns a middleware handler that serves static files in the given directory.
func Static(directory string, staticOpt ...StaticOptions) Handler {
if !filepath.IsAbs(directory) {
directory = filepath.Join(Root, directory)
}
Ian Walter commented
Thanks Allan, I should have read the code first. I'm new to go but that is pretty straightforward.
It turned out that the mapping of my Docker volume was wrong.