-
-
Save smallnest/c6e0d4688351574cd385b37c63c90190 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