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")) }