diff --git a/config.go b/config.go index 1d1c62f..e0ad442 100644 --- a/config.go +++ b/config.go @@ -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" diff --git a/config.json b/config.json index 0f106ce..4b866e6 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,7 @@ { "Host":"127.0.0.1", "Port":"8080", - "DocRoot": "./html/" + "DocRoot": "./html/", + "StaticUrl": "/", + "StripPrefix" : "/" } \ No newline at end of file diff --git a/main.go b/main.go index 6b09ec3..fb4894d 100644 --- a/main.go +++ b/main.go @@ -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)) }