Serve static files separately

It was serving all static files returning the same last one.
This commit is contained in:
Las Zenow 2017-05-29 09:45:38 +00:00
parent 825bad4540
commit 58ed66d426

View file

@ -150,8 +150,9 @@ func InitRouter(db database.DB, sg *StatsGatherer, assetsPath string) {
r.HandleFunc("/", sg.Gather(indexHandler))
for _, file := range []string{"robots.txt", "description.json", "opensearch.xml", "key.asc"} {
path := path.Join(assetsPath, file)
serveFunc := func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, path.Join(assetsPath, file))
http.ServeFile(w, r, path)
}
r.HandleFunc("/"+file, serveFunc)
}