Files
goreportcard/handlers/assets.go
2017-10-21 08:08:12 +09:00

21 lines
490 B
Go

package handlers
import (
"log"
"net/http"
)
// AssetsHandler handles serving static files
func AssetsHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Serving " + r.URL.Path[1:])
w.Header().Set("Cache-Control", "max-age=86400")
http.ServeFile(w, r, r.URL.Path[1:])
}
// FaviconHandler handles serving the favicon.ico
func FaviconHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Serving " + r.URL.Path[1:])
http.ServeFile(w, r, "assets/favicon.ico")
}