Reorganizes the project with clean MVC structure

This commit is contained in:
2016-02-11 17:04:15 +01:00
parent 143274f369
commit e109e116f5
18 changed files with 187 additions and 219 deletions

View File

@@ -119,11 +119,14 @@ func (a *appData) buildRouter() http.Handler {
return
}
io.Copy(w, rc)
_, err = io.Copy(w, rc)
if err != nil {
panic(fmt.Sprintf("internal error: %s", err))
}
})))
dirs := []string{"css", "js", "img", "fonts", "html", "bower_components"}
dirs := []string{"css", "js", "img", "bower_components"}
for _, d := range dirs {
router.ServeFiles(path.Join("/", d, "/*filepath"), http.Dir(filepath.Join("webapp", d)))
}
@@ -137,7 +140,11 @@ func (a *appData) buildRouter() http.Handler {
}
defer closeOrPanic(f, filepath.Join("webapp", "index.html"))
io.Copy(w, f)
_, err = io.Copy(w, f)
if err != nil {
panic(fmt.Sprintf("internal error: %s", err))
}
})))
return router