Ocean/StaticFiles/Map2Root.go

25 lines
591 B
Go
Raw Permalink Normal View History

package StaticFiles
import (
"github.com/SommerEngineering/Ocean/Shutdown"
"net/http"
)
2015-06-17 15:44:52 +00:00
// Handler to map the static files to the root. Use it for static web sites.
func HandlerMapStaticFiles2Root(response http.ResponseWriter, request *http.Request) {
2015-06-17 15:44:52 +00:00
// Case: The system goes down.
if Shutdown.IsDown() {
http.NotFound(response, request)
return
}
if request.RequestURI == `/` {
request.RequestURI = `/staticFiles/` + startFile4Map2Root
} else {
request.RequestURI = `/staticFiles` + request.RequestURI
}
HandlerStaticFiles(response, request)
}