Last active
November 9, 2024 08:01
-
-
Save nguyendangminh/bd6e1e01df3c6cff139b1609fc1a646c to your computer and use it in GitHub Desktop.
Serve favicon.ico in Golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
func faviconHandler(w http.ResponseWriter, r *http.Request) { | |
http.ServeFile(w, r, "relative/path/to/favicon.ico") | |
} | |
... | |
func main() { | |
http.HandleFunc("/favicon.ico", faviconHandler) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks