admin: fix static routing

This commit is contained in:
nemunaire 2016-01-22 17:34:34 +01:00
commit c9e4d3e27c
2 changed files with 23 additions and 5 deletions

View file

@ -2,8 +2,17 @@ package main
import (
"net/http"
"path"
)
func StaticRouting(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./static/index.html")
type staticRouting struct{
StaticDir string
}
func StaticHandler(staticDir string) http.Handler {
return staticRouting{staticDir}
}
func (a staticRouting) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, path.Join(a.StaticDir, "index.html"))
}