| @@ -7,9 +7,11 @@ import ( | |||
| ) | |||
| type configuration struct { | |||
| Host string | |||
| Port string | |||
| DocRoot string | |||
| Host string | |||
| Port string | |||
| DocRoot string | |||
| StaticUrl string | |||
| StripPrefix string | |||
| } | |||
| var configFile = "config.json" | |||
| @@ -1,5 +1,7 @@ | |||
| { | |||
| "Host":"127.0.0.1", | |||
| "Port":"8080", | |||
| "DocRoot": "./html/" | |||
| "DocRoot": "./html/", | |||
| "StaticUrl": "/", | |||
| "StripPrefix" : "/" | |||
| } | |||
| @@ -25,7 +25,7 @@ func main() { | |||
| func setupRootFileServer() { | |||
| fs := http.FileServer(http.Dir(config.DocRoot)) | |||
| http.Handle("/", http.StripPrefix("/", fs)) | |||
| http.Handle(config.StaticUrl, http.StripPrefix(config.StripPrefix, fs)) | |||
| } | |||