Reorganizes the project with clean MVC structure
This commit is contained in:
13
router.go
13
router.go
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user