I have one angular build files in public folder in revel appplication. I want to run those html and js files under revel application.
GET / Static.Serve("public")
I gave the above code in routes file. When I try in browser, it's showing "Forbidden Directory listing not allowed"
add these two line in routes file. Here all GET request will move to app controller Index function.
GET / App.Index
GET /* App.Index
add below code in app controller file.
func (c App) Index() revel.Result {
dir, doc := path.Split(c.Request.URL.Path)
ext := filepath.Ext(doc)
if doc == "" || ext == "" {
return c.RenderFileName("./public/index.html", "inline")
} else {
if _, err := os.Stat("./public/" + path.Join(dir, doc)); err != nil {
return c.RenderFileName("./public/index.html", "inline")
}
return c.RenderFileName("./public/" + path.Join(dir, doc), "inline")
}
}