This repository has been archived on 2025-06-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
server/admin/static.go
2016-01-23 13:19:28 +01:00

18 lines
320 B
Go

package main
import (
"net/http"
"path"
)
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"))
}