summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/main.go b/main.go
index 36c4548..ed988c9 100644
--- a/main.go
+++ b/main.go
@@ -100,6 +100,17 @@ func showWeather(w http.ResponseWriter, lat, lng float32) {
}
}
+func serveStaticFile(w http.ResponseWriter, r *http.Request) {
+ logRequest(r)
+
+ // Add Cache-Control header
+ w.Header().Set("Cache-Control", "max-age=604800")
+
+ // Serve.
+ server := http.FileServer(http.FS(peachFS))
+ server.ServeHTTP(w, r)
+}
+
func showSearch(w http.ResponseWriter, r *http.Request) {
logRequest(r)
@@ -119,17 +130,6 @@ func showSearch(w http.ResponseWriter, r *http.Request) {
}
}
-func serveStaticFile(w http.ResponseWriter, r *http.Request) {
- logRequest(r)
-
- // Add Cache-Control header
- w.Header().Set("Cache-Control", "max-age=604800")
-
- // Serve.
- server := http.FileServer(http.FS(peachFS))
- server.ServeHTTP(w, r)
-}
-
func logRequest(r *http.Request) {
addr := r.RemoteAddr
if len(r.Header.Get("X-Forwarded-For")) > 0 {