From d7191d0fbd97bfd28ba0f8c2b599ac91bcf52031 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 21 May 2023 20:13:15 +0400 Subject: [PATCH] Added /favicon.svg endpoint. --- cmd/dwelling-upload/main.go | 1 + internal/http/handlers.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cmd/dwelling-upload/main.go b/cmd/dwelling-upload/main.go index 1b3e6f1..c5a51fd 100644 --- a/cmd/dwelling-upload/main.go +++ b/cmd/dwelling-upload/main.go @@ -85,6 +85,7 @@ func main() { srv.SetNotFoundHandler(http.NotFound) srv.GET("/robots.txt", http.RobotsTxt) + srv.GET("/favicon.svg", http.Favicon) srv.ServeStatic("/assets/*filepath", hand.AssetsFS()) srv.GET("/", hand.Index) srv.POST("/", hand.Upload) diff --git a/internal/http/handlers.go b/internal/http/handlers.go index da6fae5..abb8bd2 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -225,3 +225,8 @@ func RobotsTxt(w http.ResponseWriter, r *http.Request) { data, _ := web.AssetsGetFile("robots.txt") w.Write(data) } + +func Favicon(w http.ResponseWriter, r *http.Request) { + data, _ := web.AssetsGetFile("img/favicon.svg") + w.Write(data) +}